提交 8fc893ed 编写于 作者: D DCloud_LXH

fix: canvas drawImage error question/139758

上级 d3f562d5
......@@ -36,10 +36,16 @@ import { TEMP_PATH, inflateRaw, deflateRaw } from '@dcloudio/uni-platform'
//#endregion
//#region UniServiceJSBridge
export type OperateCanvasType =
| 'actionsChanged'
| 'getImageData'
| 'putImageData'
| 'toTempFilePath'
function operateCanvas(
canvasId: string,
pageId: number,
type: unknown,
type: OperateCanvasType,
data: any,
callback?: Callback
) {
......
import { ref, computed, ExtractPropTypes, Ref, onMounted } from 'vue'
import { extend } from '@vue/shared'
import type { Actions } from '@dcloudio/uni-api'
import type { Actions, OperateCanvasType } from '@dcloudio/uni-api'
import {
useAttrs,
useContextInfo,
......@@ -73,11 +73,8 @@ const props = {
}
type Props = ExtractPropTypes<typeof props>
type triggerMethodsName =
| 'actionsChanged'
| 'getImageData'
| 'putImageData'
| 'toTempFilePath'
type MultipleArray = Array<Array<number | string | number[]>>
type LinearGradient = Parameters<CanvasFillStrokeStyles['createLinearGradient']>
export default /*#__PURE__*/ defineBuiltInComponent({
inheritAttrs: false,
......@@ -271,10 +268,6 @@ function useMethods(
}
preloadImage(actions)
for (let index = 0; index < actions.length; index++) {
type MultipleArray = Array<Array<number | string | number[]>>
type LinearGradient = Parameters<
CanvasFillStrokeStyles['createLinearGradient']
>
const action = actions[index]
let method = action.method
const data = action.data
......@@ -377,7 +370,7 @@ function useMethods(
let otherData = dataArray.slice(1)
_images = _images || {}
if (
checkImageLoaded(
!checkImageLoaded(
url,
actions.slice(index + 1),
resolve,
......@@ -700,7 +693,7 @@ function useMethods(
}
function _handleSubscribe(
type: triggerMethodsName,
type: OperateCanvasType,
data: any,
resolve: (res: { callbackId: number; data: any }) => void
) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册