Issue 30: when you now click an attachment, it becomes detached.

0 views
Skip to first unread message

Paige

unread,
Jan 21, 2009, 4:59:25 PM1/21/09
to Egg of P'an Ku-development
Okay, I tracked this down and I'm not sure how it affects your code.

http://code.google.com/p/eopk/issues/detail?id=30&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary%20Opened%20Closed

The issue happens when you left click on a card. In Eopk.py (line
1532) the "OnCardDragToPlay" function checks the x,y values of the
card against the x,y values of the event. If they are the same, the
card hasn't moved and so it does nothing. If they are different, it
moves the card to the new x,y position, detaching and moving it to the
top.

After some hair pulling and lots of debug print statements, it looks
like the cards x,y values are always off by 2. After I looked back
through the changes I found that (playfield.py) CANVAS_MOVE_SNAP had
been changed to 7.0

Setting the CANVAS_MOVE_SNAP = 5.0 fixes the issue.

So here's my question:
What does the change from 5 to 7 do? I was unable to tell what's
different on the playfield when starting a game.

Can we set this back to 5?

Thanks.

Bryan Buschmann

unread,
Jan 21, 2009, 5:07:41 PM1/21/09
to eopk-dev...@googlegroups.com
Yes, that would be one of the changes I made while I was investigating
the layout for the initial province draw.

The CANVAS_CARD_W, or the card width (which is actually half the card
width...) is 10.5, so in total the card draw width is 21 units.

If the CANVAS_MOVE_SNAP is set to 5, you have a 1 pixel deficit when the
cards are moved. They'll always snap to a different point of the grid
and they'll never line up with each other side by side. They'll either
come to rest at 20 or 25 units.

Changing the snap to 7 alleviated this visual issue as 21 / 7 = 3.0 and
the cards would fit nicely onto the grid in relationship to each other.

I'm really sorry about the hair pulling. :-( Is there something in the
OnCardDragToPlay value that is specifically using a 5 value for movement
check? I'm not sure how the snap divisor is causing x != x and y != y.

We can certainly set it back to 5, it'll just create the minor issues of
the grid snapping with the card layouts.

-Bryan

Bryan Buschmann

unread,
Jan 21, 2009, 6:42:30 PM1/21/09
to Egg of P'an Ku-development
Ok, there is a distinct value of 5 being utilized in the OnDragToPlay
event.

How are you recreating the bug? I'm dragging a 2-card stack around the
playfield without them detaching...

Bryan Buschmann

unread,
Jan 21, 2009, 6:57:34 PM1/21/09
to Egg of P'an Ku-development
After playing for a couple minutes. I see the following behaviors with
the SNAP = 7.0

Move Parent + Attachment = no bug
Change Bow/Straighten property, Attachment detaches from Parent

Attach Bowed Attachment to Parent + Move Parent = no bug

Unless I see a change in the bowed state, I can't get the Attachment
to detach from the Parent even with Snap set to 7.0

Can you confirm this? Is detaching a card calling an OnCardDragToPlay
or is there something else causing the detach?

Bryan Buschmann

unread,
Jan 21, 2009, 9:35:06 PM1/21/09
to Egg of P'an Ku-development
The plot thickens. If I use the Right Click menu to toggle the tapped
value of the card, it doesn't detach.

Paige Watson

unread,
Jan 22, 2009, 12:16:07 AM1/22/09
to eopk-dev...@googlegroups.com
Yes, this is because you can't drag a card with the right mouse button.
This only works when you left click an attached card.

I'm going to change it back to 5.0 and we can deal with the spacing issue later.  There must be an offset setting somewhere that is hard coded to work with 5.0, just can't find it right now.

Paige Watson

unread,
Jan 22, 2009, 1:09:40 AM1/22/09
to eopk-dev...@googlegroups.com

I changed this and checked it in.  We can revisit the decimal points in the snap to grid functionality later.  It worked alright before, and I’d rather it work with a slight funky offset, than unattach the cards every time.

Reply all
Reply to author
Forward
0 new messages