mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 06:28:30 +00:00
Camera won't scroll out of bounds if bounds smaller than camera size. Fix #3133.
This commit is contained in:
parent
30e9699bb6
commit
32bc4927da
1 changed files with 6 additions and 11 deletions
|
@ -21,30 +21,25 @@ var PreRender = function ()
|
|||
{
|
||||
var bounds = this._bounds;
|
||||
|
||||
// width = bounds.width;
|
||||
// height = bounds.height;
|
||||
|
||||
// var boundsX = bounds.x;
|
||||
// var boundsY = bounds.y;
|
||||
// var boundsR = Math.max(bounds.right - width, width);
|
||||
// var boundsB = Math.max(bounds.bottom - height, height);
|
||||
var bw = Math.max(0, bounds.right - width);
|
||||
var bh = Math.max(0, bounds.bottom - height);
|
||||
|
||||
if (this.scrollX < bounds.x)
|
||||
{
|
||||
this.scrollX = bounds.x;
|
||||
}
|
||||
else if (this.scrollX > bounds.right)
|
||||
else if (this.scrollX > bw)
|
||||
{
|
||||
this.scrollX = bounds.right;
|
||||
this.scrollX = bw;
|
||||
}
|
||||
|
||||
if (this.scrollY < bounds.y)
|
||||
{
|
||||
this.scrollY = bounds.y;
|
||||
}
|
||||
else if (this.scrollY > bounds.bottom)
|
||||
else if (this.scrollY > bh)
|
||||
{
|
||||
this.scrollY = bounds.bottom;
|
||||
this.scrollY = bh;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue