mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-14 12:24:04 +02:00
Only call button actions if the mouse is released inside the button. Fixes #96
This commit is contained in:
@@ -49,7 +49,7 @@ public:
|
|||||||
void SetShowSplit(bool split) { showSplit = split; }
|
void SetShowSplit(bool split) { showSplit = split; }
|
||||||
SplitButtonAction * GetSplitActionCallback() { return splitActionCallback; }
|
SplitButtonAction * GetSplitActionCallback() { return splitActionCallback; }
|
||||||
void SetSplitActionCallback(SplitButtonAction * newAction) { splitActionCallback = newAction; }
|
void SetSplitActionCallback(SplitButtonAction * newAction) { splitActionCallback = newAction; }
|
||||||
virtual void OnMouseUp(int x, int y, unsigned int button)
|
virtual void OnMouseUnclick(int x, int y, unsigned int button)
|
||||||
{
|
{
|
||||||
if(isButtonDown)
|
if(isButtonDown)
|
||||||
{
|
{
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
else if(rightDown)
|
else if(rightDown)
|
||||||
DoRightAction();
|
DoRightAction();
|
||||||
}
|
}
|
||||||
ui::Button::OnMouseUp(x, y, button);
|
ui::Button::OnMouseUnclick(x, y, button);
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual void OnMouseMovedInside(int x, int y, int dx, int dy)
|
virtual void OnMouseMovedInside(int x, int y, int dx, int dy)
|
||||||
|
@@ -142,7 +142,7 @@ void Button::Draw(const Point& screenPos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::OnMouseUp(int x, int y, unsigned int button)
|
void Button::OnMouseUnclick(int x, int y, unsigned int button)
|
||||||
{
|
{
|
||||||
if(button != 1)
|
if(button != 1)
|
||||||
{
|
{
|
||||||
@@ -183,6 +183,7 @@ void Button::OnMouseEnter(int x, int y)
|
|||||||
void Button::OnMouseLeave(int x, int y)
|
void Button::OnMouseLeave(int x, int y)
|
||||||
{
|
{
|
||||||
isMouseInside = false;
|
isMouseInside = false;
|
||||||
|
isButtonDown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::DoAction()
|
void Button::DoAction()
|
||||||
|
@@ -34,7 +34,7 @@ public:
|
|||||||
bool Enabled;
|
bool Enabled;
|
||||||
|
|
||||||
virtual void OnMouseClick(int x, int y, unsigned int button);
|
virtual void OnMouseClick(int x, int y, unsigned int button);
|
||||||
virtual void OnMouseUp(int x, int y, unsigned int button);
|
virtual void OnMouseUnclick(int x, int y, unsigned int button);
|
||||||
//virtual void OnMouseUp(int x, int y, unsigned int button);
|
//virtual void OnMouseUp(int x, int y, unsigned int button);
|
||||||
|
|
||||||
virtual void OnMouseEnter(int x, int y);
|
virtual void OnMouseEnter(int x, int y);
|
||||||
|
Reference in New Issue
Block a user