Keep track of active card sprite, making sure it keeps being shown as selectable between selection mode switches.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3487 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -723,7 +723,7 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
int size = _handSprites.size();
|
int size = _handSprites.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
CardSprite cs = (CardSprite)_handSprites.get(i);
|
CardSprite cs = (CardSprite)_handSprites.get(i);
|
||||||
cs.setLocation(cs.getX(), getHandY(cs, false, true));
|
cs.setLocation(cs.getX(), getHandY(cs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,22 +744,16 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the y location of the specified card, given its selection
|
* Determines the y location of the specified card sprite, given its
|
||||||
* state.
|
* selection state.
|
||||||
*
|
|
||||||
* @param mouseOver whether or not the mouse cursor is currently on the
|
|
||||||
* card
|
|
||||||
* @param raiseOnlySelectable whether or not to raise the only selectable
|
|
||||||
* card automatically
|
|
||||||
*/
|
*/
|
||||||
protected int getHandY (CardSprite card, boolean mouseOver,
|
protected int getHandY (CardSprite sprite)
|
||||||
boolean raiseOnlySelectable)
|
|
||||||
{
|
{
|
||||||
if (_selectedHandSprites.contains(card)) {
|
if (_selectedHandSprites.contains(sprite)) {
|
||||||
return _handLocation.y - _selectedCardOffset;
|
return _handLocation.y - _selectedCardOffset;
|
||||||
|
|
||||||
} else if (isSelectable(card) &&
|
} else if (isSelectable(sprite) &&
|
||||||
(mouseOver || (raiseOnlySelectable && isOnlySelectable(card)))) {
|
(sprite == _activeCardSprite || isOnlySelectable(sprite))) {
|
||||||
return _handLocation.y - _selectableCardOffset;
|
return _handLocation.y - _selectableCardOffset;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -845,6 +839,9 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
/** The width of the playing cards. */
|
/** The width of the playing cards. */
|
||||||
protected int _cardWidth;
|
protected int _cardWidth;
|
||||||
|
|
||||||
|
/** The currently active card sprite (the one that the mouse is over). */
|
||||||
|
protected CardSprite _activeCardSprite;
|
||||||
|
|
||||||
/** The sprites for cards within the hand. */
|
/** The sprites for cards within the hand. */
|
||||||
protected ArrayList _handSprites = new ArrayList();
|
protected ArrayList _handSprites = new ArrayList();
|
||||||
|
|
||||||
@@ -906,16 +903,14 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
public void cardSpriteEntered (CardSprite sprite, MouseEvent me) {
|
public void cardSpriteEntered (CardSprite sprite, MouseEvent me) {
|
||||||
// update the offset
|
// update the offset
|
||||||
if (_handSprites.contains(sprite)) {
|
if (_handSprites.contains(sprite)) {
|
||||||
sprite.setLocation(sprite.getX(), getHandY(sprite, true,
|
sprite.setLocation(sprite.getX(), getHandY(sprite));
|
||||||
true));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cardSpriteExited (CardSprite sprite, MouseEvent me) {
|
public void cardSpriteExited (CardSprite sprite, MouseEvent me) {
|
||||||
// update the offset
|
// update the offset
|
||||||
if (_handSprites.contains(sprite)) {
|
if (_handSprites.contains(sprite)) {
|
||||||
sprite.setLocation(sprite.getX(), getHandY(sprite, false,
|
sprite.setLocation(sprite.getX(), getHandY(sprite));
|
||||||
true));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,7 +993,6 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CardSprite _activeCardSprite;
|
|
||||||
protected int _handleX, _handleY;
|
protected int _handleX, _handleY;
|
||||||
protected boolean _hasBeenDragged;
|
protected boolean _hasBeenDragged;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user