Fixed accidental +/- of counters
Previously if you middle click on a counter (life/mana) and then click away, depending on the button clicked, the counter would +/-. I have added a fix to make sure the mouse is over the counter to change it.
This commit is contained in:
parent
11d1d22da5
commit
a873a4efa4
1 changed files with 19 additions and 17 deletions
|
@ -88,23 +88,25 @@ void AbstractCounter::setValue(int _value)
|
||||||
|
|
||||||
void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (isUnderMouse()) {
|
||||||
Command_IncCounter cmd;
|
if (event->button() == Qt::LeftButton && isUnderMouse()) {
|
||||||
cmd.set_counter_id(id);
|
Command_IncCounter cmd;
|
||||||
cmd.set_delta(1);
|
cmd.set_counter_id(id);
|
||||||
player->sendGameCommand(cmd);
|
cmd.set_delta(1);
|
||||||
event->accept();
|
player->sendGameCommand(cmd);
|
||||||
} else if (event->button() == Qt::RightButton) {
|
event->accept();
|
||||||
Command_IncCounter cmd;
|
} else if (event->button() == Qt::RightButton && isUnderMouse()) {
|
||||||
cmd.set_counter_id(id);
|
Command_IncCounter cmd;
|
||||||
cmd.set_delta(-1);
|
cmd.set_counter_id(id);
|
||||||
player->sendGameCommand(cmd);
|
cmd.set_delta(-1);
|
||||||
event->accept();
|
player->sendGameCommand(cmd);
|
||||||
} else if (event->button() == Qt::MidButton) {
|
event->accept();
|
||||||
if (menu)
|
} else if (event->button() == Qt::MidButton && isUnderMouse()) {
|
||||||
menu->exec(event->screenPos());
|
if (menu)
|
||||||
event->accept();
|
menu->exec(event->screenPos());
|
||||||
} else
|
event->accept();
|
||||||
|
}
|
||||||
|
}else
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue