Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
菜鸟程序猿_c
uni-app
提交
fea90693
U
uni-app
项目概览
菜鸟程序猿_c
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fea90693
编写于
11月 24, 2021
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(app): canvasPutImageData、canvasGetImageData
上级
fd3134d3
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
195 addition
and
265 deletion
+195
-265
packages/uni-api/package.json
packages/uni-api/package.json
+1
-1
packages/uni-api/src/service/context/canvas.ts
packages/uni-api/src/service/context/canvas.ts
+8
-14
packages/uni-app-plus/vite.config.ts
packages/uni-app-plus/vite.config.ts
+1
-1
packages/uni-components/package.json
packages/uni-components/package.json
+2
-1
packages/uni-components/src/components/canvas/index.tsx
packages/uni-components/src/components/canvas/index.tsx
+4
-5
pnpm-lock.yaml
pnpm-lock.yaml
+179
-243
未找到文件。
packages/uni-api/package.json
浏览文件 @
fea90693
...
...
@@ -16,6 +16,6 @@
"devDependencies"
:
{
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3021320211123002"
,
"@types/pako"
:
"^1.0.2"
,
"pako"
:
"^
2.0.3
"
"pako"
:
"^
1.0.11
"
}
}
packages/uni-api/src/service/context/canvas.ts
浏览文件 @
fea90693
...
...
@@ -33,7 +33,7 @@ import { getPageIdByVm, getCurrentPageVm } from '@dcloudio/uni-core'
import
{
TEMP_PATH
}
from
'
@dcloudio/uni-platform
'
//
import pako from 'pako'
import
pako
from
'
pako
'
//#endregion
//#region UniServiceJSBridge
...
...
@@ -1049,15 +1049,11 @@ export const canvasGetImageData =
let
imgData
=
data
.
data
if
(
imgData
&&
imgData
.
length
)
{
if
(
__PLATFORM__
===
'
app
'
&&
data
.
compressed
)
{
import
(
'
pako
'
).
then
((
pako
)
=>
{
imgData
=
pako
.
inflateRaw
(
imgData
)
as
any
delete
data
.
compressed
data
.
data
=
new
Uint8ClampedArray
(
imgData
)
as
any
resolve
(
data
)
})
imgData
=
pako
.
inflateRaw
(
imgData
)
as
any
}
data
.
data
=
new
Uint8ClampedArray
(
imgData
)
as
any
}
delete
data
.
compressed
resolve
(
data
)
}
operateCanvas
(
...
...
@@ -1114,14 +1110,12 @@ export const canvasPutImageData =
__PLATFORM__
===
'
app
'
&&
(
plus
.
os
.
name
!==
'
iOS
'
||
typeof
__WEEX_DEVTOOL__
===
'
boolean
'
)
)
{
return
import
(
'
pako
'
).
then
((
pako
)
=>
{
data
=
pako
.
deflateRaw
(
data
as
any
,
{
to
:
'
string
'
})
as
any
compressed
=
true
operate
()
}
)
data
=
pako
.
deflateRaw
(
data
as
any
,
{
to
:
'
string
'
})
as
any
compressed
=
true
}
else
{
// fix ... 操作符
data
=
Array
.
prototype
.
slice
.
call
(
data
)
}
// fix ... fix what?
data
=
Array
.
prototype
.
slice
.
call
(
data
)
operate
()
},
CanvasPutImageDataProtocol
,
...
...
packages/uni-app-plus/vite.config.ts
浏览文件 @
fea90693
...
...
@@ -33,7 +33,7 @@ const rollupPlugins = [
_NODE_JS_
:
0
,
},
// 忽略 pako 内部条件编译
exclude
:
[
'
**/
*/pako.esm.m
js
'
],
exclude
:
[
'
**/
pako/**/*.
js
'
],
}),
babel
({
babelHelpers
:
'
bundled
'
,
...
...
packages/uni-components/package.json
浏览文件 @
fea90693
...
...
@@ -18,6 +18,7 @@
},
"gitHead"
:
"33e807d66e1fe47e2ee08ad9c59247e37b8884da"
,
"devDependencies"
:
{
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3021320211123002"
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3021320211123002"
,
"pako"
:
"^1.0.11"
}
}
packages/uni-components/src/components/canvas/index.tsx
浏览文件 @
fea90693
...
...
@@ -18,6 +18,7 @@ import ResizeSensor from '../resize-sensor'
import
{
useNativeEvent
,
NativeEventTrigger
}
from
'
../../helpers/useEvent
'
import
{
pixelRatio
,
wrapper
,
initHidpi
}
from
'
../../helpers/hidpi
'
import
{
once
}
from
'
@dcloudio/uni-shared
'
import
pako
from
'
pako
'
const
initHidpiOnce
=
/*#__PURE__*/
once
(()
=>
{
return
__NODE_JS__
?
onMounted
(
initHidpi
)
:
initHidpi
()
...
...
@@ -561,7 +562,6 @@ function useMethods(
}
else
{
const
imgData
=
context
.
getImageData
(
0
,
0
,
destWidth
,
destHeight
)
if
(
__PLATFORM__
===
'
app
'
)
{
const
pako
=
require
(
'
pako
'
)
// eslint-disable-line no-restricted-globals
data
=
pako
.
deflateRaw
(
imgData
.
data
as
any
,
{
to
:
'
string
'
})
compressed
=
true
}
else
{
...
...
@@ -608,15 +608,14 @@ function useMethods(
resolve
:
(
res
:
any
)
=>
void
)
{
try
{
if
(
__PLATFORM__
===
'
app
'
&&
compressed
)
{
data
=
pako
.
inflateRaw
(
data
)
as
any
}
if
(
!
height
)
{
height
=
Math
.
round
(
data
.
length
/
4
/
width
)
}
const
canvas
=
getTempCanvas
(
width
,
height
)
const
context
=
canvas
.
getContext
(
'
2d
'
)
!
if
(
__PLATFORM__
===
'
app
'
&&
compressed
)
{
const
pako
=
require
(
'
pako
'
)
// eslint-disable-line no-restricted-globals
data
=
pako
.
inflateRaw
(
data
)
as
any
}
context
.
putImageData
(
new
ImageData
(
new
Uint8ClampedArray
(
data
),
width
,
height
),
0
,
...
...
pnpm-lock.yaml
浏览文件 @
fea90693
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录