ability to use zoom tool while placing stamps

This commit is contained in:
jacob1 2013-07-18 16:01:32 -04:00
parent f56a2f6000
commit fe78593ca2

View File

@ -1022,6 +1022,7 @@ void GameView::setToolButtonOffset(int offset)
void GameView::OnMouseMove(int x, int y, int dx, int dy) void GameView::OnMouseMove(int x, int y, int dx, int dy)
{ {
mousePosition = c->PointTranslate(ui::Point(x, y)); mousePosition = c->PointTranslate(ui::Point(x, y));
currentMouse = ui::Point(x, y);
if(selectMode!=SelectNone) if(selectMode!=SelectNone)
{ {
if(selectMode==PlaceSave) if(selectMode==PlaceSave)
@ -1030,7 +1031,6 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
selectPoint2 = c->PointTranslate(ui::Point(x, y)); selectPoint2 = c->PointTranslate(ui::Point(x, y));
return; return;
} }
currentMouse = ui::Point(x, y);
if(isMouseDown && drawMode == DrawPoints) if(isMouseDown && drawMode == DrawPoints)
{ {
pointQueue.push(ui::Point(c->PointTranslate(ui::Point(x-dx, y-dy)))); pointQueue.push(ui::Point(c->PointTranslate(ui::Point(x-dx, y-dy))));
@ -1074,6 +1074,10 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
} }
void GameView::OnMouseUp(int x, int y, unsigned button) void GameView::OnMouseUp(int x, int y, unsigned button)
{
if(zoomEnabled && !zoomCursorFixed)
zoomCursorFixed = true;
else
{ {
if(selectMode!=SelectNone) if(selectMode!=SelectNone)
{ {
@ -1113,15 +1117,10 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
c->StampRegion(ui::Point(x1, y1), ui::Point(x2, y2)); c->StampRegion(ui::Point(x1, y1), ui::Point(x2, y2));
} }
} }
currentMouse = ui::Point(x, y);
selectMode = SelectNone; selectMode = SelectNone;
return; return;
} }
if(zoomEnabled && !zoomCursorFixed)
zoomCursorFixed = true;
else
{
if(isMouseDown) if(isMouseDown)
{ {
isMouseDown = false; isMouseDown = false;
@ -1274,7 +1273,7 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
break; break;
} }
} }
if(key != ' ') if(key != ' ' && key != 'z')
return; return;
} }
switch(key) switch(key)
@ -1470,12 +1469,11 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
else else
c->InvertAirSim(); c->InvertAirSim();
break; break;
} case SDLK_INSERT:
if (key == SDLK_INSERT)
c->SetReplaceModeFlags(c->GetReplaceModeFlags()^REPLACE_MODE); c->SetReplaceModeFlags(c->GetReplaceModeFlags()^REPLACE_MODE);
else if (key == SDLK_DELETE) case SDLK_DELETE:
c->SetReplaceModeFlags(c->GetReplaceModeFlags()^SPECIFIC_DELETE); c->SetReplaceModeFlags(c->GetReplaceModeFlags()^SPECIFIC_DELETE);
}
if (shift && showDebug && key == '1') if (shift && showDebug && key == '1')
c->LoadRenderPreset(10); c->LoadRenderPreset(10);