Skip to content

Commit

Permalink
right order for the panel and editor
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-swf committed Jul 23, 2019
1 parent 509ab06 commit 19990a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ export class Editor extends Phaser.Group {
* @param {Phaser.Group} root
*/
constructor(game, root) {
super(game, game.stage, '_RuntimeEditor_Editor_');
super(game, null, '_RuntimeEditor_Editor_');
this.root = root;
game.add.graphics(0, 0, this)
.beginFill(0, 0.2)
.drawRect(0, 0, game.width, game.height)
.endFill();
.lineStyle(2, 0xFF0000, 0.8)
.drawRect(0, 0, game.width, game.height);
this.visible = false;
}
}
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class RuntimeEditor extends Phaser.Plugin {
*/
setup(game, group) {
const editor = new Editor(game, group)
new Panel(game, editor);
const panel = new Panel(game, editor);
game.stage.add(editor);
game.stage.add(panel);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class Panel extends Phaser.Group {
* @param {Editor} editor
*/
constructor(game, editor) {
super(game, game.stage, '_RuntimeEditor_Panel_');
super(game, null, '_RuntimeEditor_Panel_');
this.editor = editor;
this.createPanel(game);
}
Expand All @@ -15,7 +15,7 @@ export class Panel extends Phaser.Group {
* @param {Phaser.Game} game
*/
createPanel(game) {
var text = game.add.text(0, 0, 'EDIT', { font: '24px "Source Code Pro",Consolas,"Courier New",monospaced', fontWeight: 'bold', fill: '#FFFFFF' });
var text = game.add.text(0, 0, 'EDIT', { font: '16px "Source Code Pro",Consolas,"Courier New",monospaced', fontWeight: 'bold', fill: '#FFFFFF' }, this);
text.inputEnabled = true;
text.input.useHandCursor = true;
text.events.onInputDown.add(this.toggleEditor, this);
Expand Down

0 comments on commit 19990a4

Please sign in to comment.