@@ -482,6 +482,9 @@ class GameView::MenuAction: public ui::ButtonAction
482
482
}
483
483
void MouseEnterCallback (ui::Button * sender)
484
484
{
485
+ // don't immediately change the active menu, the actual set is done inside GameView::OnMouseMove
486
+ // if we change it here it causes components to be removed, which causes the window to stop sending events
487
+ // and then the previous menusection button never gets sent the OnMouseLeave event and is never unhighlighted
485
488
if (!needsClick && !v->GetMouseDown ())
486
489
v->SetActiveMenuDelayed (menuID);
487
490
}
@@ -1083,6 +1086,7 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
1083
1086
}
1084
1087
mouseInZoom = newMouseInZoom;
1085
1088
1089
+ // set active menu (delayed)
1086
1090
if (delayedActiveMenu)
1087
1091
{
1088
1092
c->SetActiveMenu (delayedActiveMenu);
@@ -1092,7 +1096,7 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
1092
1096
1093
1097
void GameView::OnMouseDown (int x, int y, unsigned button)
1094
1098
{
1095
- ui::Point mouseDownPoint = ui::Point (x, y);
1099
+ currentMouse = ui::Point (x, y);
1096
1100
if (altBehaviour && !shiftBehaviour && !ctrlBehaviour)
1097
1101
button = BUTTON_MIDDLE;
1098
1102
if (!(zoomEnabled && !zoomCursorFixed))
@@ -1101,12 +1105,12 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
1101
1105
{
1102
1106
if (button == BUTTON_LEFT && selectPoint1.X == -1 )
1103
1107
{
1104
- selectPoint1 = c->PointTranslate (mouseDownPoint );
1108
+ selectPoint1 = c->PointTranslate (currentMouse );
1105
1109
selectPoint2 = selectPoint1;
1106
1110
}
1107
1111
return ;
1108
1112
}
1109
- if (mouseDownPoint .X >= 0 && mouseDownPoint .X < XRES && mouseDownPoint .Y >= 0 && mouseDownPoint .Y < YRES)
1113
+ if (currentMouse .X >= 0 && currentMouse .X < XRES && currentMouse .Y >= 0 && currentMouse .Y < YRES)
1110
1114
{
1111
1115
if (button == BUTTON_LEFT)
1112
1116
toolIndex = 0 ;
@@ -1118,11 +1122,11 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
1118
1122
c->HistorySnapshot ();
1119
1123
if (drawMode == DrawRect || drawMode == DrawLine)
1120
1124
{
1121
- drawPoint1 = c->PointTranslate (mouseDownPoint );
1125
+ drawPoint1 = c->PointTranslate (currentMouse );
1122
1126
}
1123
1127
if (drawMode == DrawPoints)
1124
1128
{
1125
- lastPoint = currentPoint = c->PointTranslate (mouseDownPoint );
1129
+ lastPoint = currentPoint = c->PointTranslate (currentMouse );
1126
1130
c->DrawPoints (toolIndex, lastPoint, currentPoint, false );
1127
1131
}
1128
1132
}
@@ -1131,6 +1135,7 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
1131
1135
1132
1136
void GameView::OnMouseUp (int x, int y, unsigned button)
1133
1137
{
1138
+ currentMouse = ui::Point (x, y);
1134
1139
if (zoomEnabled && !zoomCursorFixed)
1135
1140
{
1136
1141
zoomCursorFixed = true ;
@@ -1184,7 +1189,7 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
1184
1189
if (isMouseDown)
1185
1190
{
1186
1191
isMouseDown = false ;
1187
- ui::Point finalDrawPoint2 = c->PointTranslate (ui::Point (x, y) );
1192
+ ui::Point finalDrawPoint2 = c->PointTranslate (currentMouse );
1188
1193
if (drawMode == DrawRect || drawMode == DrawLine)
1189
1194
{
1190
1195
drawPoint2 = finalDrawPoint2;
@@ -1590,15 +1595,9 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
1590
1595
1591
1596
void GameView::OnKeyRelease (int key, Uint16 character, bool shift, bool ctrl, bool alt)
1592
1597
{
1593
- if (ctrl && shift && drawMode != DrawPoints)
1594
- drawMode = DrawFill;
1595
- else if (ctrl && drawMode != DrawPoints)
1596
- drawMode = DrawRect;
1597
- else if (shift && drawMode != DrawPoints)
1598
- drawMode = DrawLine;
1599
- else if (!isMouseDown)
1598
+ if (!isMouseDown)
1600
1599
drawMode = DrawPoints;
1601
- else
1600
+ else if (drawMode == DrawPoints)
1602
1601
drawModeReset = true ;
1603
1602
switch (key)
1604
1603
{
0 commit comments