Browse Source

********************************** *********************
添加矩阵,调试缩放,位移

zhangweixin 3 years ago
parent
commit
1d061e1345

+ 1 - 1
gradle.properties

@@ -26,7 +26,7 @@ org.gradle.jvmargs = -Xmx1536m
 SAGA_URL = http://www.sagaloud.cn
 SAGA_KOTLIN_VERSION = 1.4.105
 SAGA_SERVICE_VERSION = 1.4.140
-SAGA_ANDROID_VERSION = 1.2.46
+SAGA_ANDROID_VERSION = 1.2.49
 SAGA_CODE = 5
 SAGA_GROUP = cn.sagacloud
 

+ 3 - 1
sybotan-android-graphy/src/main/java/com/sybotan/android/graphy/SGraphyItem.kt

@@ -69,7 +69,9 @@ open class SGraphyItem(parent: SGraphyItem? = null) {
                 ce.matrix.postScale(child._inverseScale, child._inverseScale);
             }
 //            se.setLocation((e.x - child.pos.x) / child.scale.x, (e.y - child.pos.y) / child.scale.y)
-            val matrixTransform = MatrixTools.matrixTransform(ce.matrix, e.x, e.y)
+            val matrixMat = Matrix()
+            ce.matrix.invert(matrixMat)
+            val matrixTransform = MatrixTools.matrixTransform(matrixMat, e.viewX, e.viewY)
             ce.x = matrixTransform.x
             ce.y = matrixTransform.y
             return ce

+ 1 - 1
sybotan-android-graphy/src/main/java/com/sybotan/android/graphy/SGraphyScene.kt

@@ -320,7 +320,7 @@ open class SGraphyScene {
         se.matrix.postConcat(item.scene2itemMattrix())
         val matrix = Matrix()
         se.matrix.invert(matrix)
-        val matrixTransform = MatrixTools.matrixTransform(matrix, se.x, se.y)
+        val matrixTransform = MatrixTools.matrixTransform(matrix, se.viewX, se.viewY)
         se.x = matrixTransform.x
         se.y = matrixTransform.y
 //        val p = item.mapFromScene(e.x, e.y)

+ 1 - 1
sybotan-android-graphy/src/main/java/com/sybotan/android/graphy/utils/MatrixTools.kt

@@ -12,7 +12,7 @@ object MatrixTools {
         val pointF = PointF()
         val src = kotlin.floatArrayOf(0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f)
         mat.getValues(src)
-        pointF.x = x * src[0] + y * src[1] + src[3];
+        pointF.x = x * src[0] + y * src[1] + src[2];
         pointF.y = x * src[3] + y * src[4] + src[5];
         return pointF;
     }