-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the issue related to "if i scroll once in the canvas, then clic…
…k anywhere outside, the canvas also scroll randomly", reported by Wagyl
- Loading branch information
Juan David Nicholls Cardona
authored and
Juan David Nicholls Cardona
committed
Feb 8, 2016
1 parent
eff1fc1
commit 020d220
Showing
5 changed files
with
38 additions
and
20 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "phaser-kinetic-scrolling-plugin", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"homepage": "https://github.com/jdnichollsc/Phaser-Kinetic-Scrolling-Plugin", | ||
"authors": [ | ||
"Juan David Nicholls Cardona <[email protected]>" | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* @author Juan Nicholls <[email protected]> | ||
* @copyright 2015 Juan Nicholls - http://jdnichollsc.github.io/Phaser-Kinetic-Scrolling-Plugin/ | ||
* @license {@link http://opensource.org/licenses/MIT} | ||
* @version 1.0.2 | ||
* @version 1.0.3 | ||
*/ | ||
|
||
(function (Phaser) { | ||
|
@@ -158,18 +158,27 @@ | |
|
||
this.now = Date.now(); | ||
|
||
if (this.velocityX > 10 || this.velocityX < -10) { | ||
if (this.game.input.activePointer.withinGame && (this.velocityX > 10 || this.velocityX < -10)) { | ||
this.amplitudeX = 0.8 * this.velocityX; | ||
this.targetX = Math.round(this.game.camera.x - this.amplitudeX); | ||
this.autoScrollX = true; | ||
} | ||
|
||
if (this.velocityY > 10 || this.velocityY < -10) { | ||
if (this.game.input.activePointer.withinGame && (this.velocityY > 10 || this.velocityY < -10)) { | ||
this.amplitudeY = 0.8 * this.velocityY; | ||
this.targetY = Math.round(this.game.camera.y - this.amplitudeY); | ||
this.autoScrollY = true; | ||
} | ||
|
||
if (!this.game.input.activePointer.withinGame) { | ||
|
||
if (this.settings.horizontalScroll) { | ||
this.autoScrollX = true; | ||
} | ||
if (this.settings.verticalScroll) { | ||
this.autoScrollY = true; | ||
} | ||
} | ||
}; | ||
|
||
/** | ||
|
@@ -204,13 +213,13 @@ | |
} | ||
} | ||
|
||
if (this.settings.horizontalWheel && (this.velocityWheelX < -0.1 || this.velocityWheelX > 0.1)) { | ||
if (this.settings.horizontalWheel && (this.velocityWheelX < -0.1 || this.velocityWheelX > 0.1 || !this.game.input.activePointer.withinGame)) { | ||
|
||
this.game.camera.x -= this.velocityWheelX; | ||
this.velocityWheelX *= 0.95; | ||
} | ||
|
||
if (this.settings.verticalWheel && (this.velocityWheelY < -0.1 || this.velocityWheelY > 0.1)) { | ||
if (this.settings.verticalWheel && (this.velocityWheelY < -0.1 || this.velocityWheelY > 0.1 || !this.game.input.activePointer.withinGame)) { | ||
|
||
this.game.camera.y -= this.velocityWheelY; | ||
this.velocityWheelY *= 0.95; | ||
|
@@ -256,10 +265,10 @@ | |
|
||
this.game.input.onDown.remove(this.beginMove, this); | ||
|
||
if(this.callbackID){ | ||
this.game.input.deleteMoveCallback(this.callbackID); | ||
if (this.callbackID) { | ||
this.game.input.deleteMoveCallback(this.callbackID); | ||
} | ||
else{ | ||
else { | ||
this.game.input.deleteMoveCallback(this.moveCamera, this); | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "phaser-kinetic-scrolling-plugin", | ||
"version": "1.0.2", | ||
"release": "V 1.0.2", | ||
"version": "1.0.3", | ||
"release": "V 1.0.3", | ||
"description": "Kinetic Scrolling Plugin for Phaser Framework", | ||
"author": "Juan David Nicholls Cardona <[email protected]>", | ||
"logo": "https://raw.github.com/jdnichollsc/Phaser-Kinetic-Scrolling-Plugin/gh-pages/img/plugin.png", | ||
|
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* @author Juan Nicholls <[email protected]> | ||
* @copyright 2015 Juan Nicholls - http://jdnichollsc.github.io/Phaser-Kinetic-Scrolling-Plugin/ | ||
* @license {@link http://opensource.org/licenses/MIT} | ||
* @version 1.0.2 | ||
* @version 1.0.3 | ||
*/ | ||
|
||
(function (Phaser) { | ||
|
@@ -158,18 +158,27 @@ | |
|
||
this.now = Date.now(); | ||
|
||
if (this.velocityX > 10 || this.velocityX < -10) { | ||
if (this.game.input.activePointer.withinGame && (this.velocityX > 10 || this.velocityX < -10)) { | ||
this.amplitudeX = 0.8 * this.velocityX; | ||
this.targetX = Math.round(this.game.camera.x - this.amplitudeX); | ||
this.autoScrollX = true; | ||
} | ||
|
||
if (this.velocityY > 10 || this.velocityY < -10) { | ||
if (this.game.input.activePointer.withinGame && (this.velocityY > 10 || this.velocityY < -10)) { | ||
this.amplitudeY = 0.8 * this.velocityY; | ||
this.targetY = Math.round(this.game.camera.y - this.amplitudeY); | ||
this.autoScrollY = true; | ||
} | ||
|
||
if (!this.game.input.activePointer.withinGame) { | ||
|
||
if (this.settings.horizontalScroll) { | ||
this.autoScrollX = true; | ||
} | ||
if (this.settings.verticalScroll) { | ||
this.autoScrollY = true; | ||
} | ||
} | ||
}; | ||
|
||
/** | ||
|
@@ -204,13 +213,13 @@ | |
} | ||
} | ||
|
||
if (this.settings.horizontalWheel && (this.velocityWheelX < -0.1 || this.velocityWheelX > 0.1)) { | ||
if (this.settings.horizontalWheel && (this.velocityWheelX < -0.1 || this.velocityWheelX > 0.1 || !this.game.input.activePointer.withinGame)) { | ||
|
||
this.game.camera.x -= this.velocityWheelX; | ||
this.velocityWheelX *= 0.95; | ||
} | ||
|
||
if (this.settings.verticalWheel && (this.velocityWheelY < -0.1 || this.velocityWheelY > 0.1)) { | ||
if (this.settings.verticalWheel && (this.velocityWheelY < -0.1 || this.velocityWheelY > 0.1 || !this.game.input.activePointer.withinGame)) { | ||
|
||
this.game.camera.y -= this.velocityWheelY; | ||
this.velocityWheelY *= 0.95; | ||
|
@@ -256,10 +265,10 @@ | |
|
||
this.game.input.onDown.remove(this.beginMove, this); | ||
|
||
if(this.callbackID){ | ||
this.game.input.deleteMoveCallback(this.callbackID); | ||
if (this.callbackID) { | ||
this.game.input.deleteMoveCallback(this.callbackID); | ||
} | ||
else{ | ||
else { | ||
this.game.input.deleteMoveCallback(this.moveCamera, this); | ||
} | ||
|
||
|