more tptmp mouse fixes, fix buttons and menusection buttons staying highlighted sometimes
This commit is contained in:
parent
f230ac8945
commit
13a71b611a
@ -159,6 +159,7 @@ GameView::GameView():
|
|||||||
altBehaviour(false),
|
altBehaviour(false),
|
||||||
showHud(true),
|
showHud(true),
|
||||||
showDebug(false),
|
showDebug(false),
|
||||||
|
delayedActiveMenu(0),
|
||||||
wallBrush(false),
|
wallBrush(false),
|
||||||
toolBrush(false),
|
toolBrush(false),
|
||||||
decoBrush(false),
|
decoBrush(false),
|
||||||
@ -482,7 +483,7 @@ public:
|
|||||||
void MouseEnterCallback(ui::Button * sender)
|
void MouseEnterCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
if(!needsClick && !v->GetMouseDown())
|
if(!needsClick && !v->GetMouseDown())
|
||||||
v->c->SetActiveMenu(menuID);
|
v->SetActiveMenuDelayed(menuID);
|
||||||
}
|
}
|
||||||
void ActionCallback(ui::Button * sender)
|
void ActionCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
@ -1081,10 +1082,17 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mouseInZoom = newMouseInZoom;
|
mouseInZoom = newMouseInZoom;
|
||||||
|
|
||||||
|
if (delayedActiveMenu)
|
||||||
|
{
|
||||||
|
c->SetActiveMenu(delayedActiveMenu);
|
||||||
|
delayedActiveMenu = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameView::OnMouseDown(int x, int y, unsigned button)
|
void GameView::OnMouseDown(int x, int y, unsigned button)
|
||||||
{
|
{
|
||||||
|
ui::Point mouseDownPoint = ui::Point(x, y);
|
||||||
if (altBehaviour && !shiftBehaviour && !ctrlBehaviour)
|
if (altBehaviour && !shiftBehaviour && !ctrlBehaviour)
|
||||||
button = BUTTON_MIDDLE;
|
button = BUTTON_MIDDLE;
|
||||||
if (!(zoomEnabled && !zoomCursorFixed))
|
if (!(zoomEnabled && !zoomCursorFixed))
|
||||||
@ -1093,12 +1101,12 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
|
|||||||
{
|
{
|
||||||
if (button == BUTTON_LEFT && selectPoint1.X == -1)
|
if (button == BUTTON_LEFT && selectPoint1.X == -1)
|
||||||
{
|
{
|
||||||
selectPoint1 = c->PointTranslate(ui::Point(x, y));
|
selectPoint1 = c->PointTranslate(mouseDownPoint);
|
||||||
selectPoint2 = selectPoint1;
|
selectPoint2 = selectPoint1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES)
|
if (mouseDownPoint.X >= 0 && mouseDownPoint.X < XRES && mouseDownPoint.Y >= 0 && mouseDownPoint.Y < YRES)
|
||||||
{
|
{
|
||||||
if (button == BUTTON_LEFT)
|
if (button == BUTTON_LEFT)
|
||||||
toolIndex = 0;
|
toolIndex = 0;
|
||||||
@ -1110,11 +1118,11 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
|
|||||||
c->HistorySnapshot();
|
c->HistorySnapshot();
|
||||||
if (drawMode == DrawRect || drawMode == DrawLine)
|
if (drawMode == DrawRect || drawMode == DrawLine)
|
||||||
{
|
{
|
||||||
drawPoint1 = c->PointTranslate(ui::Point(x, y));
|
drawPoint1 = c->PointTranslate(mouseDownPoint);
|
||||||
}
|
}
|
||||||
if (drawMode == DrawPoints)
|
if (drawMode == DrawPoints)
|
||||||
{
|
{
|
||||||
lastPoint = currentPoint = c->PointTranslate(ui::Point(x, y));
|
lastPoint = currentPoint = c->PointTranslate(mouseDownPoint);
|
||||||
c->DrawPoints(toolIndex, lastPoint, currentPoint, false);
|
c->DrawPoints(toolIndex, lastPoint, currentPoint, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ private:
|
|||||||
bool altBehaviour;
|
bool altBehaviour;
|
||||||
bool showHud;
|
bool showHud;
|
||||||
bool showDebug;
|
bool showDebug;
|
||||||
|
int delayedActiveMenu;
|
||||||
bool wallBrush;
|
bool wallBrush;
|
||||||
bool toolBrush;
|
bool toolBrush;
|
||||||
bool decoBrush;
|
bool decoBrush;
|
||||||
@ -139,6 +140,7 @@ public:
|
|||||||
bool GetDebugHUD();
|
bool GetDebugHUD();
|
||||||
bool GetPlacingSave();
|
bool GetPlacingSave();
|
||||||
bool GetPlacingZoom();
|
bool GetPlacingZoom();
|
||||||
|
void SetActiveMenuDelayed(int activeMenu) { delayedActiveMenu = activeMenu; }
|
||||||
bool CtrlBehaviour(){ return ctrlBehaviour; }
|
bool CtrlBehaviour(){ return ctrlBehaviour; }
|
||||||
bool ShiftBehaviour(){ return shiftBehaviour; }
|
bool ShiftBehaviour(){ return shiftBehaviour; }
|
||||||
bool AltBehaviour(){ return altBehaviour; }
|
bool AltBehaviour(){ return altBehaviour; }
|
||||||
|
@ -84,6 +84,8 @@ void Button::Draw(const Point& screenPos)
|
|||||||
ui::Colour backgroundColour = Appearance.BackgroundInactive;
|
ui::Colour backgroundColour = Appearance.BackgroundInactive;
|
||||||
|
|
||||||
if (Enabled)
|
if (Enabled)
|
||||||
|
{
|
||||||
|
if (isMouseInside)
|
||||||
{
|
{
|
||||||
if (isButtonDown || (isTogglable && toggle))
|
if (isButtonDown || (isTogglable && toggle))
|
||||||
{
|
{
|
||||||
@ -91,12 +93,13 @@ void Button::Draw(const Point& screenPos)
|
|||||||
borderColour = Appearance.BorderActive;
|
borderColour = Appearance.BorderActive;
|
||||||
backgroundColour = Appearance.BackgroundActive;
|
backgroundColour = Appearance.BackgroundActive;
|
||||||
}
|
}
|
||||||
else if (isMouseInside)
|
else
|
||||||
{
|
{
|
||||||
textColour = Appearance.TextHover;
|
textColour = Appearance.TextHover;
|
||||||
borderColour = Appearance.BorderHover;
|
borderColour = Appearance.BorderHover;
|
||||||
backgroundColour = Appearance.BackgroundHover;
|
backgroundColour = Appearance.BackgroundHover;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
textColour = Appearance.TextInactive;
|
textColour = Appearance.TextInactive;
|
||||||
|
@ -3217,12 +3217,19 @@ bool LuaScriptInterface::OnMouseDown(int x, int y, unsigned button)
|
|||||||
button = 4;
|
button = 4;
|
||||||
luacon_mousedown = true;
|
luacon_mousedown = true;
|
||||||
luacon_mousebutton = button;
|
luacon_mousebutton = button;
|
||||||
|
luacon_mousex = x;
|
||||||
|
luacon_mousey = y;
|
||||||
return luacon_mouseevent(x, y, button, LUACON_MDOWN, 0);
|
return luacon_mouseevent(x, y, button, LUACON_MDOWN, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LuaScriptInterface::OnMouseUp(int x, int y, unsigned button, char type)
|
bool LuaScriptInterface::OnMouseUp(int x, int y, unsigned button, char type)
|
||||||
{
|
{
|
||||||
luacon_mousebutton = 0;
|
luacon_mousebutton = 0;
|
||||||
|
if (type != 1)
|
||||||
|
{
|
||||||
|
luacon_mousex = x;
|
||||||
|
luacon_mousey = y;
|
||||||
|
}
|
||||||
if (button == 3)
|
if (button == 3)
|
||||||
button = 4;
|
button = 4;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user