Skip to content

Commit 745a260

Browse files
committed
Merge branch 'ES5'
# Conflicts: # src/PathBuilder.js
2 parents 6ffd71d + 5886b21 commit 745a260

File tree

7 files changed

+34
-36
lines changed

7 files changed

+34
-36
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## Version 1.6.0 - May 20th 2018
2+
3+
### Features
4+
5+
-
6+
7+
### Updates
8+
9+
- Update to Phaser 3.8.0.
10+
- Integrate API changes.
11+
- Added ES5 Branch.
12+
13+
### Bug Fixes
14+
15+
- Fixed issue where middle mouse button press would place A point.
16+
- Fixed issue where right mouse button press would undo A placement.
17+
18+
### Thanks
19+
20+
-
21+
122
## Version 1.5.0 - May 11th 2018
223

324
### Features

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,9 @@ A tool to build paths for [Pathfollowers](https://labs.phaser.io/index.html?dir=
2121
```
2222
function preload ()
2323
{
24-
this.load.plugin('PathBuilder', 'path/to/PathBuilder.js');
24+
this.load.scenePlugin('PathBuilder', 'path/to/PathBuilder.js');
2525
}
2626
```
27-
3.
28-
```
29-
30-
function create ()
31-
{
32-
this.sys.install('PathBuilder');
33-
}
34-
```
35-
3627
* UI:
3728

3829
* Controls:
@@ -60,8 +51,8 @@ function create ()
6051

6152
## Requirements:
6253

63-
* Phaser 3 (at least 3.3.0, not working in 3.7.1).
64-
* Mouse with middle mouse button click.
54+
* Phaser 3, latest recommended to guarantee matching API.
55+
* Mouse with middle mouse button if you want to explore A scene.
6556
* Chrome browser recommended.
6657

6758
## Dev notes

dist/PathBuilder.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -310,30 +310,21 @@ var PathBuilder = function (scene) {
310310
this.scene = scene;
311311
this.systems = scene.sys;
312312

313-
if (!scene.sys.settings.isBooted) {
314-
scene.sys.events.on('boot', this.boot, this);
315-
}
316313
};
317314

318315
PathBuilder.UI = __webpack_require__(2);
319316
PathBuilder.Scene = __webpack_require__(8);
320317

321-
PathBuilder.register = function (PluginManager) {
322-
323-
PluginManager.register('PathBuilder', PathBuilder, 'curveGenerator');
324-
};
325-
326318
PathBuilder.prototype = {
327319

328320
boot: function () {
329321
var eventEmitter = this.systems.events;
330322

331323
eventEmitter.on('shutdown', this.shutdown, this);
332324
eventEmitter.on('destroy', this.destroy, this);
333-
334-
//TODO: rewrite game variable
335-
this.scene.sys.game.scene.add('UI', PathBuilder.Scene, true);
336-
325+
326+
//TODO: rewrite according API
327+
this.systems.scenePlugin.add('UI', PathBuilder.Scene, true);
337328
},
338329

339330
// Called when a Scene shuts down, it may then come back again later (which will invoke the 'start' event) but should be considered dormant.
@@ -901,7 +892,7 @@ var Pointer = function (ui, x, y, key, frame) {
901892

902893
this.scene.input.on('pointerdown', function (pointer, gameObject) {
903894

904-
if (this.scene.mode == "draw" && pointer.dragState ==0) {
895+
if (this.scene.mode == "draw" && pointer.dragState ==0 && pointer.leftButtonDown()) {
905896
if (gameObject.length ==0 && (pointer.x > 50 && pointer.x < this.scene.W - 100)) {
906897

907898
var _dx = this.scene.drawpanel.camera.scrollX;
@@ -912,7 +903,7 @@ var Pointer = function (ui, x, y, key, frame) {
912903
}
913904

914905

915-
if(pointer.rightButtonDown() && this.scene.input.activePointer.dragState == 0)
906+
if(pointer.rightButtonDown() && pointer.dragState == 0)
916907
{
917908
this.lockX = pointer.x;
918909
this.lockY = pointer.y;
@@ -981,8 +972,6 @@ Pointer.prototype.switchmode = function (mode) {
981972
this.menu.forEach(function(element){ element.setVisible(false)});
982973
}
983974
if (mode == "select"){
984-
this.scene.undo();
985-
986975
this.setVisible(false);
987976
this.menu.forEach(function(element){ element.setVisible(true)});
988977

dist/PathBuilder.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ function preload()
2121
this.load.image('dude', 'assets/sprites/phaser-dude.png');
2222
this.load.json('data', 'assets/paths/data.json');
2323

24-
this.load.plugin('PathBuilder', 'dist/PathBuilder.min.js');
24+
this.load.scenePlugin('PathBuilder', 'dist/PathBuilder.min.js');
2525

2626
}
2727

2828
function create()
2929
{
3030
this.cameras.main.setBackgroundColor(0x11155);
31-
this.sys.install('PathBuilder');
3231

3332
player = this.add.image(400, 300, 'dude').setScale(6, 6);
3433
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "phaser3-plugin-pathbuilder",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"description": "Draw and edit Lines, Bezier Curves, Splines during runtime and export them for path tweens and PathFollowers in Phaser 3",
55
"main": "src/PathBuilder.js",
66
"scripts": {

src/UI/Pointer.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var Pointer = function (ui, x, y, key, frame) {
1313

1414
this.scene.input.on('pointerdown', function (pointer, gameObject) {
1515

16-
if (this.scene.mode == "draw" && pointer.dragState ==0) {
16+
if (this.scene.mode == "draw" && pointer.dragState ==0 && pointer.leftButtonDown()) {
1717
if (gameObject.length ==0 && (pointer.x > 50 && pointer.x < this.scene.W - 100)) {
1818

1919
var _dx = this.scene.drawpanel.camera.scrollX;
@@ -24,7 +24,7 @@ var Pointer = function (ui, x, y, key, frame) {
2424
}
2525

2626

27-
if(pointer.rightButtonDown() && this.scene.input.activePointer.dragState == 0)
27+
if(pointer.rightButtonDown() && pointer.dragState == 0)
2828
{
2929
this.lockX = pointer.x;
3030
this.lockY = pointer.y;
@@ -93,8 +93,6 @@ Pointer.prototype.switchmode = function (mode) {
9393
this.menu.forEach(function(element){ element.setVisible(false)});
9494
}
9595
if (mode == "select"){
96-
this.scene.undo();
97-
9896
this.setVisible(false);
9997
this.menu.forEach(function(element){ element.setVisible(true)});
10098

0 commit comments

Comments
 (0)