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); + } } /** * 设置名称显示