Skip to content

Commit 79f35c4

Browse files
committed
Merge pull request #1445 from kellyelton/master
Fixed some issues with card inversion and card sizes fixes #1444
2 parents d3c084c + fd9fbfe commit 79f35c4

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

octgnFX/Octgn/Play/Gui/CardControl.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ private void PropertyChangeHandler(object sender, PropertyChangedEventArgs e)
382382
private void UpdateInvertedTransform()
383383
{
384384
if (_invertTransform == null || Card == null) return;
385-
IsInverted = TableControl.IsInInvertedZone(Card.Y);
385+
IsInverted = TableControl.IsInInvertedZone(Card.Y, Card.Size);
386386
_invertTransform.ScaleX = _invertTransform.ScaleY = IsInverted ? -1 : 1;
387387
}
388388

octgnFX/Octgn/Play/Gui/TableControl.xaml.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using System.Windows.Media.Imaging;
1313
using System.Windows.Threading;
1414
using System.Threading.Tasks;
15-
15+
using Octgn.DataNew.Entities;
1616
using Octgn.Play.Actions;
1717
using Octgn.Play.Gui.Adorners;
1818
using 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);

recentchanges.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fixed the transparent click through of images - Kelly
1+
Fixed some issues with card inversion and custom sizes - Kelly

0 commit comments

Comments
 (0)