summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/canvastoolselections.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/canvastoolselections.cc b/src/canvastoolselections.cc
index ff1056e..0012d8e 100644
--- a/src/canvastoolselections.cc
+++ b/src/canvastoolselections.cc
@@ -64,7 +64,7 @@ bool CanvasToolSelections::mouseMoveEvent(QMouseEvent* event)
{
float val = unmapX(event->x());
if(val > act_sel.to) val = act_sel.to - 1;
- act_sel.from = val;
+ act_sel.from = std::max(0.0f, val);
selections.update(active_selection, act_sel);
canvas->update();
return true;
@@ -74,7 +74,7 @@ bool CanvasToolSelections::mouseMoveEvent(QMouseEvent* event)
{
float val = unmapX(event->x());
if(val < act_sel.from) val = act_sel.from + 1;
- act_sel.to = val;
+ act_sel.to = std::min(val, (float)canvas->size);
selections.update(active_selection, act_sel);
canvas->update();
return true;