Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
06ce0ef3
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
06ce0ef3
编写于
11月 24, 2021
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: canvas use pako
上级
0200ea64
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
18101 addition
and
17981 deletion
+18101
-17981
packages/uni-api/package.json
packages/uni-api/package.json
+1
-3
packages/uni-api/src/service/context/canvas.ts
packages/uni-api/src/service/context/canvas.ts
+3
-4
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+16172
-16056
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+3
-3
packages/uni-app-plus/package.json
packages/uni-app-plus/package.json
+2
-0
packages/uni-app-plus/src/platform/index.ts
packages/uni-app-plus/src/platform/index.ts
+2
-0
packages/uni-components/package.json
packages/uni-components/package.json
+1
-2
packages/uni-components/src/components/canvas/index.tsx
packages/uni-components/src/components/canvas/index.tsx
+4
-3
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+7
-3
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+11
-4
packages/uni-h5/package.json
packages/uni-h5/package.json
+0
-1
packages/uni-h5/src/platform/index.ts
packages/uni-h5/src/platform/index.ts
+3
-0
packages/uni-h5/vite.config.ts
packages/uni-h5/vite.config.ts
+0
-2
packages/uni-stat/dist/uni-stat.cjs.js
packages/uni-stat/dist/uni-stat.cjs.js
+944
-944
packages/uni-stat/dist/uni-stat.es.js
packages/uni-stat/dist/uni-stat.es.js
+944
-944
pnpm-lock.yaml
pnpm-lock.yaml
+4
-12
未找到文件。
packages/uni-api/package.json
浏览文件 @
06ce0ef3
...
...
@@ -14,8 +14,6 @@
"url"
:
"https://github.com/dcloudio/uni-app/issues"
},
"devDependencies"
:
{
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3021320211123002"
,
"@types/pako"
:
"^1.0.2"
,
"pako"
:
"^1.0.11"
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3021320211123002"
}
}
packages/uni-api/src/service/context/canvas.ts
浏览文件 @
06ce0ef3
...
...
@@ -31,9 +31,8 @@ import { once, ON_ERROR } from '@dcloudio/uni-shared'
import
{
getPageIdByVm
,
getCurrentPageVm
}
from
'
@dcloudio/uni-core
'
import
{
TEMP_PATH
}
from
'
@dcloudio/uni-platform
'
import
{
TEMP_PATH
,
inflateRaw
,
deflateRaw
}
from
'
@dcloudio/uni-platform
'
import
pako
from
'
pako
'
//#endregion
//#region UniServiceJSBridge
...
...
@@ -1049,7 +1048,7 @@ export const canvasGetImageData =
let
imgData
=
data
.
data
if
(
imgData
&&
imgData
.
length
)
{
if
(
__PLATFORM__
===
'
app
'
&&
data
.
compressed
)
{
imgData
=
pako
.
inflateRaw
(
imgData
)
as
any
imgData
=
inflateRaw
(
imgData
)
as
any
}
data
.
data
=
new
Uint8ClampedArray
(
imgData
)
as
any
}
...
...
@@ -1110,7 +1109,7 @@ export const canvasPutImageData =
__PLATFORM__
===
'
app
'
&&
(
plus
.
os
.
name
!==
'
iOS
'
||
typeof
__WEEX_DEVTOOL__
===
'
boolean
'
)
)
{
data
=
pako
.
deflateRaw
(
data
as
any
,
{
to
:
'
string
'
})
as
any
data
=
deflateRaw
(
data
as
any
,
{
to
:
'
string
'
})
as
any
compressed
=
true
}
else
{
// fix ... 操作符
...
...
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
06ce0ef3
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
06ce0ef3
此差异已折叠。
点击以展开。
packages/uni-app-plus/package.json
浏览文件 @
06ce0ef3
...
...
@@ -32,8 +32,10 @@
"@dcloudio/uni-h5"
:
"3.0.0-alpha-3021320211123002"
,
"@dcloudio/uni-i18n"
:
"3.0.0-alpha-3021320211123002"
,
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3021320211123002"
,
"@types/pako"
:
"1.0.2"
,
"@vue/compiler-sfc"
:
"3.2.22"
,
"autoprefixer"
:
"^10.4.0"
,
"pako"
:
"^1.0.11"
,
"vue"
:
"3.2.22"
},
"dependencies"
:
{
...
...
packages/uni-app-plus/src/platform/index.ts
浏览文件 @
06ce0ef3
...
...
@@ -29,3 +29,5 @@ export {
getEnterOptions
,
getLaunchOptions
,
}
from
'
../service/framework/app/utils
'
export
{
inflateRaw
,
deflateRaw
}
from
'
pako
'
packages/uni-components/package.json
浏览文件 @
06ce0ef3
...
...
@@ -18,7 +18,6 @@
},
"gitHead"
:
"33e807d66e1fe47e2ee08ad9c59247e37b8884da"
,
"devDependencies"
:
{
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3021320211123002"
,
"pako"
:
"^1.0.11"
"@dcloudio/uni-shared"
:
"3.0.0-alpha-3021320211123002"
}
}
packages/uni-components/src/components/canvas/index.tsx
浏览文件 @
06ce0ef3
...
...
@@ -13,12 +13,13 @@ import {
saveImage
,
getSameOriginUrl
,
getRealPath
,
inflateRaw
,
deflateRaw
,
}
from
'
@dcloudio/uni-platform
'
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
()
...
...
@@ -562,7 +563,7 @@ function useMethods(
}
else
{
const
imgData
=
context
.
getImageData
(
0
,
0
,
destWidth
,
destHeight
)
if
(
__PLATFORM__
===
'
app
'
)
{
data
=
pako
.
deflateRaw
(
imgData
.
data
as
any
,
{
to
:
'
string
'
})
data
=
deflateRaw
(
imgData
.
data
as
any
,
{
to
:
'
string
'
})
compressed
=
true
}
else
{
// fix [...]展开TypedArray在低版本手机报错的问题,使用Array.prototype.slice
...
...
@@ -609,7 +610,7 @@ function useMethods(
)
{
try
{
if
(
__PLATFORM__
===
'
app
'
&&
compressed
)
{
data
=
pako
.
inflateRaw
(
data
)
as
any
data
=
inflateRaw
(
data
)
as
any
}
if
(
!
height
)
{
height
=
Math
.
round
(
data
.
length
/
4
/
width
)
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
06ce0ef3
...
...
@@ -142,7 +142,7 @@ function initNavigationBarI18n(navigationBar) {
}
}
function
initTabBarI18n
(
tabBar2
)
{
if
(
isEnableLocale
())
{
if
(
isEnableLocale
()
&&
tabBar2
.
list
)
{
tabBar2
.
list
.
forEach
((
item
)
=>
{
defineI18nProperty
(
item
,
[
"
text
"
]);
});
...
...
@@ -1561,6 +1561,10 @@ function getSameOriginUrl(url) {
}
return
urlToFile
(
url
).
then
(
fileToUrl
);
}
const
inflateRaw
=
(...
args
)
=>
{
};
const
deflateRaw
=
(...
args
)
=>
{
};
var
ResizeSensor
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
ResizeSensor
"
,
props
:
{
...
...
@@ -2043,13 +2047,13 @@ function useMethods(canvasRef, actionsWaiting) {
compressed
},
resolve
)
{
try
{
if
(
false
)
;
if
(
!
height
)
{
height
=
Math
.
round
(
data
.
length
/
4
/
width
);
}
const
canvas
=
getTempCanvas
(
width
,
height
);
const
context
=
canvas
.
getContext
(
"
2d
"
);
if
(
false
)
;
context
.
putImageData
(
new
ImageData
(
new
Uint8ClampedArray
(
data
),
width
,
height
),
0
,
0
);
canvasRef
.
value
.
getContext
(
"
2d
"
).
drawImage
(
canvas
,
x
,
y
,
width
,
height
);
canvas
.
height
=
canvas
.
width
=
0
;
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
06ce0ef3
...
...
@@ -328,7 +328,7 @@ function initNavigationBarI18n(navigationBar) {
}
}
function initTabBarI18n(tabBar2) {
if (isEnableLocale()) {
if (isEnableLocale()
&& tabBar2.list
) {
tabBar2.list.forEach((item) => {
defineI18nProperty(item, ["text"]);
});
...
...
@@ -3946,6 +3946,7 @@ const canvasGetImageData = /* @__PURE__ */ defineAsyncApi(API_CANVAS_GET_IMAGE_D
if (imgData && imgData.length) {
data.data = new Uint8ClampedArray(imgData);
}
delete data.compressed;
resolve(data);
}
operateCanvas(canvasId, pageId, "getImageData", {
...
...
@@ -3978,7 +3979,9 @@ const canvasPutImageData = /* @__PURE__ */ defineAsyncApi(API_CANVAS_PUT_IMAGE_D
resolve(data2);
});
};
data = Array.prototype.slice.call(data);
{
data = Array.prototype.slice.call(data);
}
operate();
}, CanvasPutImageDataProtocol, CanvasPutImageDataOptions);
const canvasToTempFilePath = /* @__PURE__ */ defineAsyncApi(API_CANVAS_TO_TEMP_FILE_PATH, ({
...
...
@@ -6115,6 +6118,10 @@ function initLaunchOptions({
extend(enterOptions, launchOptions);
return launchOptions;
}
const inflateRaw = (...args) => {
};
const deflateRaw = (...args) => {
};
var ResizeSensor = /* @__PURE__ */ defineBuiltInComponent({
name: "ResizeSensor",
props: {
...
...
@@ -6745,13 +6752,13 @@ function useMethods(canvasRef, actionsWaiting) {
compressed
}, resolve) {
try {
if (false)
;
if (!height) {
height = Math.round(data.length / 4 / width);
}
const canvas = getTempCanvas(width, height);
const context = canvas.getContext("2d");
if (false)
;
context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0);
canvasRef.value.getContext("2d").drawImage(canvas, x, y, width, height);
canvas.height = canvas.width = 0;
...
...
packages/uni-h5/package.json
浏览文件 @
06ce0ef3
...
...
@@ -36,7 +36,6 @@
"@vue/server-renderer"
:
"3.2.22"
,
"@vue/shared"
:
"3.2.22"
,
"localstorage-polyfill"
:
"^1.0.1"
,
"pako"
:
"^2.0.3"
,
"safe-area-insets"
:
"^1.4.1"
,
"vue-router"
:
"^4.0.12"
,
"xmlhttprequest"
:
"^1.8.0"
...
...
packages/uni-h5/src/platform/index.ts
浏览文件 @
06ce0ef3
...
...
@@ -16,3 +16,6 @@ export * from './saveImage'
export
*
from
'
./constants
'
export
{
getSameOriginUrl
}
from
'
../helpers/file
'
export
{
getEnterOptions
,
getLaunchOptions
}
from
'
../framework/setup/utils
'
export
const
inflateRaw
=
(...
args
:
any
[]):
any
=>
{}
export
const
deflateRaw
=
(...
args
:
any
[]):
any
=>
{}
packages/uni-h5/vite.config.ts
浏览文件 @
06ce0ef3
...
...
@@ -38,8 +38,6 @@ const rollupPlugins = [
// 该插件限制了不能以__开头
_NODE_JS_
:
FORMAT
===
'
cjs
'
?
1
:
0
,
},
// 忽略 pako 内部条件编译
exclude
:
[
'
**/*/pako.esm.mjs
'
],
}),
]
if
(
FORMAT
===
'
cjs
'
)
{
...
...
packages/uni-stat/dist/uni-stat.cjs.js
浏览文件 @
06ce0ef3
此差异已折叠。
点击以展开。
packages/uni-stat/dist/uni-stat.es.js
浏览文件 @
06ce0ef3
此差异已折叠。
点击以展开。
pnpm-lock.yaml
浏览文件 @
06ce0ef3
...
...
@@ -144,12 +144,8 @@ importers:
packages/uni-api
:
specifiers
:
'
@dcloudio/uni-shared'
:
3.0.0-alpha-3021320211123002
'
@types/pako'
:
^1.0.2
pako
:
^1.0.11
devDependencies
:
'
@dcloudio/uni-shared'
:
link:../uni-shared
'
@types/pako'
:
1.0.2
pako
:
1.0.11
packages/uni-app
:
specifiers
:
...
...
@@ -175,8 +171,10 @@ importers:
'
@dcloudio/uni-h5'
:
3.0.0-alpha-3021320211123002
'
@dcloudio/uni-i18n'
:
3.0.0-alpha-3021320211123002
'
@dcloudio/uni-shared'
:
3.0.0-alpha-3021320211123002
'
@types/pako'
:
1.0.2
'
@vue/compiler-sfc'
:
3.2.22
autoprefixer
:
^10.4.0
pako
:
^1.0.11
vue
:
3.2.22
dependencies
:
'
@dcloudio/uni-app-vite'
:
link:../uni-app-vite
...
...
@@ -186,8 +184,10 @@ importers:
'
@dcloudio/uni-h5'
:
link:../uni-h5
'
@dcloudio/uni-i18n'
:
link:../uni-i18n
'
@dcloudio/uni-shared'
:
link:../uni-shared
'
@types/pako'
:
1.0.2
'
@vue/compiler-sfc'
:
3.2.22
autoprefixer
:
10.4.0
pako
:
1.0.11
vue
:
3.2.22
packages/uni-app-vite
:
...
...
@@ -441,10 +441,8 @@ importers:
packages/uni-components
:
specifiers
:
'
@dcloudio/uni-shared'
:
3.0.0-alpha-3021320211123002
pako
:
^1.0.11
devDependencies
:
'
@dcloudio/uni-shared'
:
link:../uni-shared
pako
:
1.0.11
packages/uni-core
:
specifiers
:
...
...
@@ -471,7 +469,6 @@ importers:
'
@vue/shared'
:
3.2.22
acorn-loose
:
^8.2.1
localstorage-polyfill
:
^1.0.1
pako
:
^2.0.3
safe-area-insets
:
^1.4.1
vue
:
3.2.22
vue-router
:
^4.0.12
...
...
@@ -484,7 +481,6 @@ importers:
'
@vue/server-renderer'
:
3.2.22_vue@3.2.22
'
@vue/shared'
:
3.2.22
localstorage-polyfill
:
1.0.1
pako
:
2.0.4
safe-area-insets
:
1.4.1
vue-router
:
4.0.12_vue@3.2.22
xmlhttprequest
:
1.8.0
...
...
@@ -6987,10 +6983,6 @@ packages:
resolution
:
{
integrity
:
sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==
}
dev
:
true
/pako/2.0.4
:
resolution
:
{
integrity
:
sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg==
}
dev
:
false
/parent-module/1.0.1
:
resolution
:
{
integrity
:
sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==
}
engines
:
{
node
:
'
>=6'
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录