Browse Source

测试真机矩阵BUG

caner 1 year ago
parent
commit
535eec30f0
3 changed files with 9 additions and 9 deletions
  1. BIN
      .DS_Store
  2. 8 8
      index/drawCanvas.js
  3. 1 1
      project.private.config.json

BIN
.DS_Store


+ 8 - 8
index/drawCanvas.js

@@ -3,8 +3,8 @@ class DrawCanvas {
   constructor() {
   constructor() {
     this._ctx = null
     this._ctx = null
     this._canvas = null
     this._canvas = null
-    this._executionArr = []
-    this._pathArr = []
+    this._executionArr = [] //每移动一笔的数据
+    this._pathArr = [] //抬起落下为一笔
     this._style = null
     this._style = null
     this._matrix = null
     this._matrix = null
   }
   }
@@ -16,14 +16,14 @@ class DrawCanvas {
     canvas.height = height
     canvas.height = height
     this._canvas = canvas
     this._canvas = canvas
     this._ctx = ctx
     this._ctx = ctx
-    this._matrix = ctx.getTransform() //矩阵
-    this._executionArr = [] //每移动一笔的数据
-    this._pathArr = [] //抬起落下为一笔
+    this._matrix = ctx.getTransform() //IOS真机矩阵没有返回完整参数,导致无法旋转
+    this._executionArr = []
+    this._pathArr = []
     // 添加路径底图 
     // 添加路径底图 
     const path = this.sPath2cPath(dicTypePath)
     const path = this.sPath2cPath(dicTypePath)
     if (path) {
     if (path) {
       this._ctx.stroke(path)
       this._ctx.stroke(path)
-      this._ctx.clip(path) //IOS 下裁切后无法继续画图
+      // this._ctx.clip(path) //IOS真机裁切后,导致无法画图
     }
     }
     callBack()
     callBack()
     console.log('初始化完成');
     console.log('初始化完成');
@@ -79,9 +79,9 @@ class DrawCanvas {
     img.src = url
     img.src = url
     img.onload = () => {
     img.onload = () => {
       const fillStyle = this._ctx.createPattern(img, 'repeat')
       const fillStyle = this._ctx.createPattern(img, 'repeat')
-      console.log('画笔样式', fillStyle);
+      console.log('画笔样式', fillStyle, this._matrix);
       // 旋转 + 矩阵变化
       // 旋转 + 矩阵变化
-      if (angle && this._matrix) {
+      if (angle && this._matrix && this._matrix.rotateSelf) {
         this._matrix.rotateSelf(angle)
         this._matrix.rotateSelf(angle)
         fillStyle.setTransform(this._matrix)
         fillStyle.setTransform(this._matrix)
       }
       }

+ 1 - 1
project.private.config.json

@@ -5,5 +5,5 @@
     "compileHotReLoad": true,
     "compileHotReLoad": true,
     "skylineRenderEnable": true
     "skylineRenderEnable": true
   },
   },
-  "libVersion": "3.4.9"
+  "libVersion": "3.4.10"
 }
 }