-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fe520f
commit 93fac42
Showing
5 changed files
with
81 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export class RotationGizmo extends Phaser.Graphics { | ||
constructor(game: Phaser.Game) { | ||
super(game); | ||
this.__skip = true; | ||
this | ||
.beginFill(0, 0) | ||
.drawCircle(0, 0, 18) | ||
.endFill() | ||
.lineStyle(2, 0xFFFFFF, 1) | ||
.beginFill(0x1ABC9C, 1) | ||
.drawCircle(0, 0, 14); | ||
|
||
this.inputEnabled = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { RotationGizmo } from './rotation.gizmo'; | ||
|
||
export class RotationHandler extends Phaser.Group { | ||
private gizmos: RotationGizmo[]; | ||
|
||
constructor(game: Phaser.Game) { | ||
super(game); | ||
this.gizmos = this.createGizmos(game); | ||
} | ||
|
||
private createGizmos(game: Phaser.Game) { | ||
const gizmos: RotationGizmo[] = [ | ||
new RotationGizmo(game), // top left | ||
new RotationGizmo(game), // top right | ||
new RotationGizmo(game), // bottom right | ||
new RotationGizmo(game), // bottom left | ||
]; | ||
|
||
gizmos.forEach(gizmo => { | ||
// gizmo.events.onInputDown.add(() => this.startScaling(gizmo), this); | ||
// gizmo.events.onInputUp.add(this.stopScaling, this); | ||
this.addChild(gizmo); | ||
}); | ||
|
||
return gizmos; | ||
} | ||
|
||
public redraw(bounds: PIXI.Rectangle) { | ||
const knobs = this.gizmos; | ||
knobs[0].position.set(0, 0); // top left | ||
knobs[1].position.set(bounds.width, 0); // top right | ||
knobs[2].position.set(bounds.width, bounds.height); // bottom right | ||
knobs[3].position.set(0, bounds.height); // bottom right | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/editor/selection/scale/scale.knob.ts → src/editor/selection/scale/scale.gizmo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters