| | |
| | | // batch move |
| | | if (this.selectedSprites && this.selectedSprites.length > 0) { |
| | | let batchMove = false; |
| | | let batchMoveStartPos = null; |
| | | |
| | | const batchMoving = (event) => { |
| | | if (batchMove) { |
| | | // offset move val |
| | | var mouseMovement = { |
| | | x: (event.global.x - this.batchMoveStartPos.x) / this.scale, |
| | | y: (event.global.y - this.batchMoveStartPos.y) / this.scale |
| | | x: (event.global.x - batchMoveStartPos.x) / this.scale, |
| | | y: (event.global.y - batchMoveStartPos.y) / this.scale |
| | | }; |
| | | for (let sprite of this.selectedSprites) { |
| | | sprite.position.x = sprite.data.batchMoveStartPos.x + mouseMovement.x; |
| | |
| | | |
| | | const batchMoveEnd = (event) => { |
| | | batchMove = false; |
| | | batchMoveStartPos = null; |
| | | this.selectedSprites.forEach(child => { |
| | | Utils.unMarkSprite(child); |
| | | }) |
| | |
| | | } |
| | | |
| | | const batchMoveStart = (event) => { |
| | | this.batchMoveStartPos = { x: event.data.global.clone().x, y: event.data.global.clone().y }; |
| | | batchMoveStartPos = { x: event.data.global.clone().x, y: event.data.global.clone().y }; |
| | | this.selectedSprites.forEach(child => { |
| | | child.data.batchMoveStartPos = { x: child.position.x, y: child.position.y }; |
| | | }) |