faterhenry 6 years ago
parent
commit
d04c93dd2a

+ 68 - 20
src/main/java/com/bomostory/sceneeditmodule/screen/view/EditActorView.kt

@@ -120,11 +120,23 @@ open class EditActorView @JvmOverloads constructor(
                         true ->  my
                         true ->  my
                         false -> mx
                         false -> mx
                     }
                     }
-                    var actorData = actor
-                    actorData.sideLength = sizeX + dP
-                    actorData.sideHeight = sizeY + dP
-                    actorData.positionX = x
-                    actorData.positionY = y
+                    var actorData = Actor().apply {
+                        sideLength = sizeX + dP
+                        sideHeight = sizeY + dP
+                        this.positionX = x
+                        this.positionY = y
+                        resourcePath = actor.resourcePath
+                        text = actor.text
+                        textColor = actor.textColor
+                        textAlign = actor.textAlign
+                        positionZ = actor.positionZ
+                        isSelect = actor.isSelect
+                        parentLayerIndex = actor.parentLayerIndex
+                        isMovable = actor.isMovable
+                        isDialogue = actor.isDialogue
+                        isMirror = actor.isMirror
+                        opacity = actor.opacity
+                    }
                     actor = actorData
                     actor = actorData
                 }
                 }
                 MotionEvent.ACTION_UP -> {
                 MotionEvent.ACTION_UP -> {
@@ -161,11 +173,23 @@ open class EditActorView @JvmOverloads constructor(
                         true ->  my
                         true ->  my
                         false -> mx
                         false -> mx
                     }
                     }
-                    var actorData = actor
-                    actorData.sideLength = sizeX - dP
-                    actorData.sideHeight = sizeY - dP
-                    actorData.positionX = x + dP
-                    actorData.positionY = y + dP
+                    var actorData = Actor().apply {
+                        sideLength = sizeX - dP
+                        sideHeight = sizeY - dP
+                        this.positionX = x + dP
+                        this.positionY = y + dP
+                        resourcePath = actor.resourcePath
+                        text = actor.text
+                        textColor = actor.textColor
+                        textAlign = actor.textAlign
+                        positionZ = actor.positionZ
+                        isSelect = actor.isSelect
+                        parentLayerIndex = actor.parentLayerIndex
+                        isMovable = actor.isMovable
+                        isDialogue = actor.isDialogue
+                        isMirror = actor.isMirror
+                        opacity = actor.opacity
+                    }
                     actor = actorData
                     actor = actorData
                 }
                 }
                 MotionEvent.ACTION_UP -> {
                 MotionEvent.ACTION_UP -> {
@@ -202,11 +226,23 @@ open class EditActorView @JvmOverloads constructor(
                         true ->  my
                         true ->  my
                         false -> mx
                         false -> mx
                     }
                     }
-                    var actorData = actor
-                    actorData.sideLength = sizeX + mx
-                    actorData.sideHeight = sizeY - my
-                    actorData.positionX = x
-                    actorData.positionY = y + my
+                    var actorData = Actor().apply {
+                        sideLength = sizeX + mx
+                        sideHeight = sizeY - my
+                        this.positionX = x
+                        this.positionY = y + my
+                        resourcePath = actor.resourcePath
+                        text = actor.text
+                        textColor = actor.textColor
+                        textAlign = actor.textAlign
+                        positionZ = actor.positionZ
+                        isSelect = actor.isSelect
+                        parentLayerIndex = actor.parentLayerIndex
+                        isMovable = actor.isMovable
+                        isDialogue = actor.isDialogue
+                        isMirror = actor.isMirror
+                        opacity = actor.opacity
+                    }
                     actor = actorData
                     actor = actorData
                 }
                 }
                 MotionEvent.ACTION_UP -> {
                 MotionEvent.ACTION_UP -> {
@@ -239,11 +275,23 @@ open class EditActorView @JvmOverloads constructor(
                 MotionEvent.ACTION_MOVE -> {
                 MotionEvent.ACTION_MOVE -> {
                     var mx =  motionEvent.rawX.toInt() - positionX
                     var mx =  motionEvent.rawX.toInt() - positionX
                     var my =  motionEvent.rawY.toInt() - positionY
                     var my =  motionEvent.rawY.toInt() - positionY
-                    var actorData = actor
-                    actorData.sideLength = sizeX - mx
-                    actorData.sideHeight = sizeY + my
-                    actorData.positionX = x + mx
-                    actorData.positionY = y
+                    var actorData = Actor().apply {
+                        sideLength = sizeX - mx
+                        sideHeight = sizeY + my
+                        this.positionX = x + mx
+                        this.positionY = y
+                        resourcePath = actor.resourcePath
+                        text = actor.text
+                        textColor = actor.textColor
+                        textAlign = actor.textAlign
+                        positionZ = actor.positionZ
+                        isSelect = actor.isSelect
+                        parentLayerIndex = actor.parentLayerIndex
+                        isMovable = actor.isMovable
+                        isDialogue = actor.isDialogue
+                        isMirror = actor.isMirror
+                        opacity = actor.opacity
+                    }
                     actor = actorData
                     actor = actorData
                 }
                 }
                 MotionEvent.ACTION_UP -> {
                 MotionEvent.ACTION_UP -> {