File tree 1 file changed +4
-11
lines changed
1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -627,18 +627,13 @@ export class Sprite extends SpriteBase {
627
627
break ;
628
628
}
629
629
this . direction = this . radToScratch ( Math . atan2 ( dy , dx ) ) ;
630
- const { x, y } = this . keepInFence ( this . x , this . y ) ;
631
- this . goto ( x , y ) ;
630
+ this . positionInFence ( ) ;
632
631
}
633
632
634
- keepInFence ( newX , newY ) {
633
+ positionInFence ( ) {
635
634
// https://github.com/LLK/scratch-vm/blob/develop/src/sprites/rendered-target.js#L949
636
635
const fence = this . stage . fence ;
637
636
const bounds = this . _project . renderer . getTightBoundingBox ( this ) ;
638
- bounds . left += newX - this . x ;
639
- bounds . right += newX - this . x ;
640
- bounds . top += newY - this . y ;
641
- bounds . bottom += newY - this . y ;
642
637
643
638
let dx = 0 ,
644
639
dy = 0 ;
@@ -654,10 +649,8 @@ export class Sprite extends SpriteBase {
654
649
if ( bounds . bottom < fence . bottom ) {
655
650
dy += fence . bottom - bounds . bottom ;
656
651
}
657
- return {
658
- x : newX + dx ,
659
- y : newY + dy
660
- } ;
652
+
653
+ this . goto ( this . x + dx , this . y + dy ) ;
661
654
}
662
655
663
656
get penDown ( ) {
You can’t perform that action at this time.
0 commit comments