1212using System . Windows . Media . Imaging ;
1313using System . Windows . Threading ;
1414using System . Threading . Tasks ;
15-
15+ using Octgn . DataNew . Entities ;
1616using Octgn . Play . Actions ;
1717using Octgn . Play . Gui . Adorners ;
1818using Octgn . Play . Gui . DragOperations ;
@@ -331,9 +331,9 @@ internal void SetBackground(string url, string bs)
331331 // boardContainer.Children.Insert(0, img);
332332 //}
333333
334- public static bool IsInInvertedZone ( double y )
334+ public static bool IsInInvertedZone ( double y , CardSize size )
335335 {
336- return y < - Program . GameEngine . Definition . CardSize . Height / 2 ;
336+ return y < - size . Height / 2 ;
337337 }
338338
339339 private void CardMoved ( object sender , EventArgs e )
@@ -388,7 +388,7 @@ protected override void OnCardOver(object sender, CardsEventArgs e)
388388 {
389389 if ( adorner == null || adorner . SourceCard == null || adorner . SourceCard . Card == null ) continue ;
390390 double y = baseY + adorner . SourceCard . Card . Y - baseCard . Y ;
391- adorner . OnHoverRequestInverted = IsInInvertedZone ( y ) ^ Player . LocalPlayer . InvertedTable ;
391+ adorner . OnHoverRequestInverted = IsInInvertedZone ( y , adorner . SourceCard . Card . Size ) ^ Player . LocalPlayer . InvertedTable ;
392392 }
393393 }
394394
@@ -415,7 +415,7 @@ protected override void OnCardDropped(object sender, CardsEventArgs e)
415415 if ( Program . GameSettings . UseTwoSidedTable && ( e . ClickedCard . Orientation & CardOrientation . Rot90 ) != 0 )
416416 {
417417 // We have to offset the position if we cross the middle line
418- bool newPosInverted = IsInInvertedZone ( pt . Y ) ;
418+ bool newPosInverted = IsInInvertedZone ( pt . Y , e . ClickedCard . Size ) ;
419419 if ( cardCtrl != null && ( ! cardCtrl . IsInverted && newPosInverted ) )
420420 {
421421 delta = cardCtrl . Card . RealHeight - cardCtrl . Card . RealWidth ;
@@ -486,8 +486,8 @@ protected override void OnCardDropped(object sender, CardsEventArgs e)
486486 // If the card is tapped and has crossed the middle line in a two-sided table, we have to adjust its position
487487 if ( Program . GameSettings . UseTwoSidedTable && ( c . Orientation & CardOrientation . Rot90 ) != 0 )
488488 {
489- bool oldPosInverted = IsInInvertedZone ( c . Y ) ;
490- bool newPosInverted = IsInInvertedZone ( y ) ;
489+ bool oldPosInverted = IsInInvertedZone ( c . Y , c . Size ) ;
490+ bool newPosInverted = IsInInvertedZone ( y , c . Size ) ;
491491 if ( ! oldPosInverted && newPosInverted )
492492 {
493493 delta = c . RealHeight - c . RealWidth ;
@@ -1058,7 +1058,7 @@ private static Rect ComputeCardBounds(Card c)
10581058 ! Program . GameSettings . UseTwoSidedTable
10591059 ? new Rect ( c . X , c . Y + h - w , h , w )
10601060 : // Case 3: rotated card on a 2-sided table, the card is not inversed
1061- ! IsInInvertedZone ( c . Y )
1061+ ! IsInInvertedZone ( c . Y , c . Size )
10621062 ? new Rect ( c . X , c . Y + h - w , h , w )
10631063 : // Case 4: rotated and inversed card on a 2-sided table
10641064 new Rect ( c . X - h + w , c . Y , h , w ) ;
0 commit comments