Browse Source

更新版本1.5.1.20210715

[修正] 背景图旋转后图标拖动异常
tangshan
徐振升 3 years ago
parent
commit
0610c3ad7e
  1. 2
      src/app/working-area/model/axImageShape.ts
  2. 23
      src/app/working-area/model/axShape.ts
  3. 2
      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) {
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;

23
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 => {

2
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';
/**
*
*/

Loading…
Cancel
Save