Browse Source

更新版本1.5.1.20210715

[修正] 背景图旋转后图标拖动异常
master
徐振升 4 years ago
parent
commit
794e9da071
  1. 2
      src/app/working-area/model/axImageShape.ts
  2. 23
      src/app/working-area/model/axShape.ts
  3. 7
      src/app/working-area/working-area.component.ts

2
src/app/working-area/model/axImageShape.ts

@ -236,7 +236,7 @@ export class AxImageShape extends AxShape {
if (this.rightDrag) { if (this.rightDrag) {
this.rightDrag = false; this.rightDrag = false;
this.image.anchor.set(0.5); 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; this.right.visible = false;

23
src/app/working-area/model/axShape.ts

@ -42,7 +42,7 @@ export class AxShape extends Graphics {
} }
if (this.allowEdit) { if (this.allowEdit) {
this.mouseDragging = true; 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 => { .on('pointerup', event => {
@ -53,15 +53,26 @@ export class AxShape extends Graphics {
}) })
.on('pointermove', event => { .on('pointermove', event => {
if (this.mouseDragging) { 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 => { this.workingArea.selection.all().forEach(item => {
const x = event.data.global.x - this.mousePosition.x; item.x += offsetX;
const y = event.data.global.y - this.mousePosition.y; item.y += offsetY;
item.x += x * (1 / this.workingArea.camera2D.scale.x);
item.y += y * (1 / this.workingArea.camera2D.scale.y);
item.assetData.Point = new PIXI.Point(item.x, item.y); item.assetData.Point = new PIXI.Point(item.x, item.y);
this.workingArea.canvasData.isChange = true; this.workingArea.canvasData.isChange = true;
}); });
this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y); this.mousePosition = newPosition;
} }
}) })
.on('rightclick', event => { .on('rightclick', event => {

7
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() { 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);
}
} }
/** /**
* *

Loading…
Cancel
Save