Fix some off-by-one mouse clamping issues
This commit is contained in:
parent
76477e1b46
commit
58fa3dd539
@ -341,7 +341,7 @@ ui::Point GameController::PointTranslate(ui::Point point)
|
|||||||
if(point.X >= XRES)
|
if(point.X >= XRES)
|
||||||
point.X = XRES-1;
|
point.X = XRES-1;
|
||||||
if(point.Y >= YRES)
|
if(point.Y >= YRES)
|
||||||
point.Y = YRES+1;
|
point.Y = YRES-1;
|
||||||
if(point.Y < 0)
|
if(point.Y < 0)
|
||||||
point.Y = 0;
|
point.Y = 0;
|
||||||
if(point.X < 0)
|
if(point.X < 0)
|
||||||
|
@ -997,7 +997,7 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(currentMouse.X > 0 && currentMouse.X < XRES && currentMouse.Y > 0 && currentMouse.Y < YRES && !(zoomEnabled && !zoomCursorFixed))
|
if(currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES && !(zoomEnabled && !zoomCursorFixed))
|
||||||
{
|
{
|
||||||
if(button == BUTTON_LEFT)
|
if(button == BUTTON_LEFT)
|
||||||
toolIndex = 0;
|
toolIndex = 0;
|
||||||
@ -1761,7 +1761,7 @@ void GameView::OnDraw()
|
|||||||
{
|
{
|
||||||
ren->clearScreen(1.0f);
|
ren->clearScreen(1.0f);
|
||||||
ren->RenderBegin();
|
ren->RenderBegin();
|
||||||
if(selectMode == SelectNone && (!zoomEnabled || zoomCursorFixed) && activeBrush && currentMouse.X > 0 && currentMouse.X < XRES && currentMouse.Y > 0 && currentMouse.Y < YRES)
|
if(selectMode == SelectNone && (!zoomEnabled || zoomCursorFixed) && activeBrush && currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES)
|
||||||
{
|
{
|
||||||
ui::Point finalCurrentMouse = c->PointTranslate(currentMouse);
|
ui::Point finalCurrentMouse = c->PointTranslate(currentMouse);
|
||||||
ui::Point initialDrawPoint = drawPoint1;
|
ui::Point initialDrawPoint = drawPoint1;
|
||||||
|
Loading…
Reference in New Issue
Block a user