Browse Source

********************************** *********************
修改视图获取宽高的方式

zhangweixin 3 years ago
parent
commit
c83b2a1cc9

+ 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.49
+SAGA_ANDROID_VERSION = 1.2.52
 SAGA_CODE = 5
 SAGA_GROUP = cn.sagacloud
 

+ 13 - 4
sybotan-android-graphy/src/main/java/com/sybotan/android/graphy/SGraphyView.kt

@@ -134,11 +134,20 @@ open class SGraphyView(context: Context, attrs: AttributeSet? = null)
             return
         }
 
-        val w = width.toFloat()
-        val h = height.toFloat()
-        val rect = scene!!.worldRect()
-        setCenterPoint( PointF(rect.centerX(), rect.centerY()),
+        this.post {
+            val w = width.toFloat()
+            val h = height.toFloat()
+
+            val rect = scene!!.worldRect()
+            setCenterPoint( PointF(rect.centerX(), rect.centerY()),
                 min(w / rect.width(), h / rect.height()) * fitrate)
+        }
+
+//        val w = width.toFloat()
+//        val h = height.toFloat()
+//        val rect = scene!!.worldRect()
+//        setCenterPoint( PointF(rect.centerX(), rect.centerY()),
+//                min(w / rect.width(), h / rect.height()) * fitrate)
     } // Function FitView()
 
     /**