Skip to content

Commit

Permalink
[#737] Fix anchorPoint Infinities - Thanks @Giwayume
Browse files Browse the repository at this point in the history
- See discussion: #738 (comment)
  • Loading branch information
parasyte committed Sep 6, 2015
1 parent 54cd1fb commit 83e4ae0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/level/TMXLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
}

if (typeof(settings.anchorPoint) === "undefined") {
var aw = me.game.viewport.bounds.width - this.imagewidth,
ah = me.game.viewport.bounds.height - this.imageheight;

/**
* Define how the image is anchored to the viewport bounds<br>
* By default, its upper-left corner is anchored to the viewport bounds upper left corner.<br>
Expand All @@ -140,8 +143,8 @@
* @name me.ImageLayer#anchorPoint
*/
this.anchorPoint.set(
x / (me.game.viewport.bounds.width - this.imagewidth) || 0,
y / (me.game.viewport.bounds.height - this.imageheight) || 0
aw ? x / aw : 0,
ah ? y / ah : 0
);
}
else {
Expand Down

0 comments on commit 83e4ae0

Please sign in to comment.