File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -374,15 +374,15 @@ Phaser.TilemapLayer.prototype.resizeWorld = function () {
374374*/
375375Phaser . TilemapLayer . prototype . _fixX = function ( x ) {
376376
377- if ( x < 0 )
378- {
379- x = 0 ;
380- }
381-
382- if ( this . scrollFactorX === 1 )
377+ if ( this . scrollFactorX === 1 || ( this . scrollFactorX === 0 && this . position . x === 0 ) )
383378 {
384379 return x ;
385380 }
381+
382+ //This executes if the scrollFactorX is 0 and the x position of the tilemap is off from standard.
383+ if ( this . scrollFactorX === 0 && this . position . x !== 0 ) {
384+ return x - this . position . x ;
385+ }
386386
387387 return this . _scrollX + ( x - ( this . _scrollX / this . scrollFactorX ) ) ;
388388
@@ -417,16 +417,17 @@ Phaser.TilemapLayer.prototype._unfixX = function (x) {
417417*/
418418Phaser . TilemapLayer . prototype . _fixY = function ( y ) {
419419
420- if ( y < 0 )
420+ if ( this . scrollFactorY === 1 || ( this . scrollFactorY === 0 && this . position . y === 0 ) )
421421 {
422- y = 0 ;
422+ return y ;
423423 }
424-
425- if ( this . scrollFactorY === 1 )
424+
425+ //This executes if the scrollFactorY is 0 and the y position of the tilemap is off from standard.
426+ if ( this . scrollFactorY === 0 && this . position . y !== 0 )
426427 {
427- return y ;
428+ return y - this . position . y
428429 }
429-
430+
430431 return this . _scrollY + ( y - ( this . _scrollY / this . scrollFactorY ) ) ;
431432
432433} ;
You can’t perform that action at this time.
0 commit comments