You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
779 B
28 lines
779 B
4 years ago
|
import { Sprite, Texture } from 'pixi.js';
|
||
|
import { WorkingAreaComponent } from '../working-area.component';
|
||
|
import { AxShape } from './axShape';
|
||
|
|
||
|
export class AxPreviewImageShape extends AxShape {
|
||
|
image: Sprite = null;
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
constructor(workingArea: WorkingAreaComponent) {
|
||
|
super(null, workingArea);
|
||
|
this.image = new Sprite();
|
||
|
this.image.width = 32;
|
||
|
this.image.height = 32;
|
||
|
this.image.anchor.set(0.5);
|
||
|
this.interactive = false;
|
||
|
this.scale.set(1 / this.workingArea.backgroundImage.scale.x);
|
||
|
this.addChild(this.image);
|
||
|
}
|
||
|
/**
|
||
|
* 重新设置图片地址
|
||
|
* @param url 图片路径
|
||
|
*/
|
||
|
setImageUrl(url: string) {
|
||
|
this.image.texture = Texture.from(url);
|
||
|
}
|
||
|
}
|