Skip to content

Commit

Permalink
Merge branch 'ES5'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/PathBuilder.js
  • Loading branch information
samid737 committed May 20, 2018
2 parents 6ffd71d + 5886b21 commit 745a260
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 36 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## Version 1.6.0 - May 20th 2018

### Features

-

### Updates

- Update to Phaser 3.8.0.
- Integrate API changes.
- Added ES5 Branch.

### Bug Fixes

- Fixed issue where middle mouse button press would place A point.
- Fixed issue where right mouse button press would undo A placement.

### Thanks

-

## Version 1.5.0 - May 11th 2018

### Features
Expand Down
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,9 @@ A tool to build paths for [Pathfollowers](https://labs.phaser.io/index.html?dir=
```
function preload ()
{
this.load.plugin('PathBuilder', 'path/to/PathBuilder.js');
this.load.scenePlugin('PathBuilder', 'path/to/PathBuilder.js');
}
```
3.
```
function create ()
{
this.sys.install('PathBuilder');
}
```

* UI:

* Controls:
Expand Down Expand Up @@ -60,8 +51,8 @@ function create ()

## Requirements:

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

## Dev notes
Expand Down
21 changes: 5 additions & 16 deletions dist/PathBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,30 +310,21 @@ var PathBuilder = function (scene) {
this.scene = scene;
this.systems = scene.sys;

if (!scene.sys.settings.isBooted) {
scene.sys.events.on('boot', this.boot, this);
}
};

PathBuilder.UI = __webpack_require__(2);
PathBuilder.Scene = __webpack_require__(8);

PathBuilder.register = function (PluginManager) {

PluginManager.register('PathBuilder', PathBuilder, 'curveGenerator');
};

PathBuilder.prototype = {

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

eventEmitter.on('shutdown', this.shutdown, this);
eventEmitter.on('destroy', this.destroy, this);

//TODO: rewrite game variable
this.scene.sys.game.scene.add('UI', PathBuilder.Scene, true);


//TODO: rewrite according API
this.systems.scenePlugin.add('UI', PathBuilder.Scene, true);
},

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

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

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

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


if(pointer.rightButtonDown() && this.scene.input.activePointer.dragState == 0)
if(pointer.rightButtonDown() && pointer.dragState == 0)
{
this.lockX = pointer.x;
this.lockY = pointer.y;
Expand Down Expand Up @@ -981,8 +972,6 @@ Pointer.prototype.switchmode = function (mode) {
this.menu.forEach(function(element){ element.setVisible(false)});
}
if (mode == "select"){
this.scene.undo();

this.setVisible(false);
this.menu.forEach(function(element){ element.setVisible(true)});

Expand Down
2 changes: 1 addition & 1 deletion dist/PathBuilder.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions examples/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ function preload()
this.load.image('dude', 'assets/sprites/phaser-dude.png');
this.load.json('data', 'assets/paths/data.json');

this.load.plugin('PathBuilder', 'dist/PathBuilder.min.js');
this.load.scenePlugin('PathBuilder', 'dist/PathBuilder.min.js');

}

function create()
{
this.cameras.main.setBackgroundColor(0x11155);
this.sys.install('PathBuilder');

player = this.add.image(400, 300, 'dude').setScale(6, 6);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phaser3-plugin-pathbuilder",
"version": "1.5.0",
"version": "1.6.0",
"description": "Draw and edit Lines, Bezier Curves, Splines during runtime and export them for path tweens and PathFollowers in Phaser 3",
"main": "src/PathBuilder.js",
"scripts": {
Expand Down
6 changes: 2 additions & 4 deletions src/UI/Pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var Pointer = function (ui, x, y, key, frame) {

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

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

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


if(pointer.rightButtonDown() && this.scene.input.activePointer.dragState == 0)
if(pointer.rightButtonDown() && pointer.dragState == 0)
{
this.lockX = pointer.x;
this.lockY = pointer.y;
Expand Down Expand Up @@ -93,8 +93,6 @@ Pointer.prototype.switchmode = function (mode) {
this.menu.forEach(function(element){ element.setVisible(false)});
}
if (mode == "select"){
this.scene.undo();

this.setVisible(false);
this.menu.forEach(function(element){ element.setVisible(true)});

Expand Down

0 comments on commit 745a260

Please sign in to comment.