@@ -585,10 +585,10 @@ function findTransPolygon(trans, start) {
585
585
}
586
586
587
587
var cornerShapes = [ 0x1 , 0x2 , 0x4 , 0x6 , 0x7 , 0x8 , 0x9 , 0xB , 0xD , 0xE ] ;
588
- var leftShapes = [ 0x8 , 0x9 , 0xC , 0xD , 0xF ] ;
589
- var upShapes = [ 0x4 , 0x5 , 0x6 , 0x7 , 0xF ] ;
590
- var rightShapes = [ 0x1 , 0x3 , 0x9 , 0xB , 0xF ] ;
591
- var downShapes = [ 0x2 , 0x6 , 0xA , 0xE , 0xF ] ;
588
+ var leftShapes = [ 0x8 , 0xC , 0xD ] ;
589
+ var upShapes = [ 0x4 , 0x5 , 0x7 ] ;
590
+ var rightShapes = [ 0x1 , 0x3 , 0xB ] ;
591
+ var downShapes = [ 0x2 , 0xA , 0xE ] ;
592
592
593
593
var points = [ ] ;
594
594
while ( points . length === 0 || points [ 0 ] . x !== x || points [ 0 ] . y !== y ) {
@@ -597,14 +597,25 @@ function findTransPolygon(trans, start) {
597
597
if ( cornerShapes . includes ( shape ) )
598
598
points . push ( Qt . point ( x , y ) ) ;
599
599
600
- if ( direction !== right && leftShapes . includes ( shape ) )
600
+ // Movements are determined by traversing the polygon clockwise
601
+ if ( leftShapes . includes ( shape ) )
601
602
goLeft ( ) ;
602
- else if ( direction !== down && upShapes . includes ( shape ) )
603
+ else if ( upShapes . includes ( shape ) )
603
604
goUp ( ) ;
604
- else if ( direction !== left && rightShapes . includes ( shape ) )
605
+ else if ( rightShapes . includes ( shape ) )
605
606
goRight ( ) ;
606
- else if ( direction !== up && downShapes . includes ( shape ) )
607
+ else if ( downShapes . includes ( shape ) )
607
608
goDown ( ) ;
609
+ else if ( direction === left && shape === 0x6 )
610
+ goUp ( ) ;
611
+ else if ( direction === up && shape === 0x9 )
612
+ goRight ( ) ;
613
+ else if ( direction === right && shape === 0x6 )
614
+ goDown ( ) ;
615
+ else if ( direction === down && shape === 0x9 )
616
+ goLeft ( ) ;
617
+ else
618
+ goRight ( ) ;
608
619
}
609
620
points . push ( Qt . point ( x , y ) ) ;
610
621
0 commit comments