From 794e9da0713727d8120c714877a85628e3bb9e29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=AF=E5=8D=87?= <359059686@qq.com> Date: Thu, 15 Jul 2021 14:40:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC1.5.1.20210?= =?UTF-8?q?715=20[=E4=BF=AE=E6=AD=A3]=20=E8=83=8C=E6=99=AF=E5=9B=BE?= =?UTF-8?q?=E6=97=8B=E8=BD=AC=E5=90=8E=E5=9B=BE=E6=A0=87=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/working-area/model/axImageShape.ts | 2 +- src/app/working-area/model/axShape.ts | 23 ++++++++++++++----- .../working-area/working-area.component.ts | 7 +++--- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/app/working-area/model/axImageShape.ts b/src/app/working-area/model/axImageShape.ts index ddb7ccf..8a757f1 100644 --- a/src/app/working-area/model/axImageShape.ts +++ b/src/app/working-area/model/axImageShape.ts @@ -236,7 +236,7 @@ export class AxImageShape extends AxShape { if (this.rightDrag) { this.rightDrag = false; this.image.anchor.set(0.5); - this.image.position.set(this.image.position.x + (this.image.width / 2)); + this.image.position.set(this.image.position.x + (this.image.width / 2), this.image.position.y); } }); this.right.visible = false; diff --git a/src/app/working-area/model/axShape.ts b/src/app/working-area/model/axShape.ts index 85ab02c..7675dae 100644 --- a/src/app/working-area/model/axShape.ts +++ b/src/app/working-area/model/axShape.ts @@ -42,7 +42,7 @@ export class AxShape extends Graphics { } if (this.allowEdit) { this.mouseDragging = true; - this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y); + this.mousePosition = event.data.getLocalPosition(this.workingArea.backgroundImage); } }) .on('pointerup', event => { @@ -53,15 +53,26 @@ export class AxShape extends Graphics { }) .on('pointermove', event => { if (this.mouseDragging) { + // const newPosition = event.data.getLocalPosition(this.workingArea.backgroundImage); + // const x = newPosition.x - this.x; + // const y = newPosition.y - this.y; + // this.workingArea.selection.all().forEach(item => { + // item.x += x; + // item.y += y; + // item.assetData.Point = new PIXI.Point(item.x, item.y); + // this.workingArea.canvasData.isChange = true; + // }); + + const newPosition = event.data.getLocalPosition(this.workingArea.backgroundImage); + const offsetX = newPosition.x - this.mousePosition.x; + const offsetY = newPosition.y - this.mousePosition.y; this.workingArea.selection.all().forEach(item => { - const x = event.data.global.x - this.mousePosition.x; - const y = event.data.global.y - this.mousePosition.y; - item.x += x * (1 / this.workingArea.camera2D.scale.x); - item.y += y * (1 / this.workingArea.camera2D.scale.y); + item.x += offsetX; + item.y += offsetY; item.assetData.Point = new PIXI.Point(item.x, item.y); this.workingArea.canvasData.isChange = true; }); - this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y); + this.mousePosition = newPosition; } }) .on('rightclick', event => { diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 76e673a..e784d80 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -175,7 +175,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 重大调整-主版本号增加 * 日期变更-日期版本号增加 */ - public VERSION = '1.5.0.20210507_rc'; + public VERSION = '1.5.1.20210715'; /** * 数据初始化 */ @@ -641,8 +641,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV * 重置画布 */ public resetCanvas() { - this.app.renderer.resize(this.content.nativeElement.clientWidth, this.content.nativeElement.clientHeight); - + if (!this.init.isGis) { + this.app.renderer.resize(this.content.nativeElement.clientWidth, this.content.nativeElement.clientHeight); + } } /** * 设置名称显示