Skip to content

Commit

Permalink
selection keeps the selected object
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-swf committed Aug 27, 2021
1 parent 9aa75be commit 47fe449
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/editor/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ const ANCHOR_COLOR = 0xFFFFFF;
const ANCHOR_STROKE = 0xD9B448;

export class Selection extends Phaser.Graphics {
private _obj: PIXI.DisplayObject;

constructor(game: Phaser.Game) {
super(game);
this.__skip = true;
}

public setSelection(obj: PIXI.DisplayObject) {
this._obj = obj;
this.clear();
if (!obj) return;

Expand All @@ -26,7 +34,9 @@ export class Selection extends Phaser.Graphics {
.lineStyle(4, BORDER_STROKE, 1)
.drawRect(0, 0, bounds.width, bounds.height)
.lineStyle(2, BORDER_COLOR, 1)
.drawRect(0, 0, bounds.width, bounds.height);
.beginFill(0, 0)
.drawRect(0, 0, bounds.width, bounds.height)
.endFill();
}

private drawPivot(pivot: PIXI.Point) {
Expand Down

0 comments on commit 47fe449

Please sign in to comment.