Browse Source

[修正] 单点图标缩放固定大小

develop
徐振升 4 years ago
parent
commit
fd078d3584
  1. 17
      src/app/working-area/working-area.component.ts

17
src/app/working-area/working-area.component.ts

@ -140,6 +140,8 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
if (delta > 0) {
if (this.backgroundImage.scale.x >= 32) {
this.backgroundImage.scale.x = 32;
this.backgroundImage.scale.y = 32;
this.emit('mouseWheel', this.backgroundImage.scale.x);
return;
}
this.backgroundImage.pivot.set(pivot.x, pivot.y);
@ -151,7 +153,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.backgroundImage.position.y += delY;
} else if (delta < 0) {
if (this.backgroundImage.scale.x <= 0.1) {
this.backgroundImage.scale.x = 0.1;
this.backgroundImage.scale.y = 0.1;
this.emit('mouseWheel', this.backgroundImage.scale.x);
return;
}
this.backgroundImage.pivot.set(pivot.x, pivot.y);
@ -162,6 +166,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
this.backgroundImage.position.x += delX;
this.backgroundImage.position.y += delY;
}
this.emit('mouseWheel', this.backgroundImage.scale.x);
}
/**
*
@ -845,8 +850,8 @@ export class SinglePointIcon extends PIXI.Container {
this.y = this.assetData.Point.y;
this.name = this.assetData.Id;
const singlePointIcon = PIXI.Sprite.from(this.assetData.ImageUrl);
singlePointIcon.x = 0; // this.assetData.Point.x;
singlePointIcon.y = 0; // this.assetData.Point.y;
singlePointIcon.x = 0;
singlePointIcon.y = 0;
singlePointIcon.width = this.assetData.Width;
singlePointIcon.height = this.assetData.Height;
@ -892,6 +897,14 @@ export class SinglePointIcon extends PIXI.Container {
});
this.workingArea.on('mouseWheel', data => {
if (this.assetData.FixedSize) {
const scale = 1 / data;
console.log(scale);
this.scale.set(scale);
}
});
this.text.x = singlePointIcon.x;
this.text.y = singlePointIcon.y - singlePointIcon.height / 2;
this.text.anchor.set(0.5, 1);

Loading…
Cancel
Save