1
0
forked from 0ad/0ad

Support double-click on unit group buttons. patch by Merolum. fixes #805.

This was SVN commit r9592.
This commit is contained in:
Badmadblacksad 2011-06-06 19:31:34 +00:00
parent 6b0cbd10c3
commit 9906a86a2e
2 changed files with 11 additions and 1 deletions

View File

@ -245,6 +245,7 @@ function updateGroups()
else
button.hidden = false;
button.onpress = (function(i) { return function() { performGroup("select", i); } })(i);
button.ondoublepress = (function(i) { return function() { performGroup("snap", i); } })(i);
}
var numButtons = i;
var rowLength = 1;

View File

@ -63,7 +63,16 @@ void IGUIButtonBehavior::HandleMessage(SGUIMessage &Message)
{
m_Pressed = false;
// BUTTON WAS CLICKED
SendEvent(GUIM_PRESSED, "press");
if (Message.type == GUIM_MOUSE_RELEASE_LEFT)
{
SendEvent(GUIM_PRESSED, "press");
}
// BUTTON WAS DOUBLE CLICKED
else
{
if (SendEvent(GUIM_MOUSE_DBLCLICK_LEFT, "doublepress") == IN_PASS)
SendEvent(GUIM_PRESSED, "press");
}
}
} break;