diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-09-15 12:14:17 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-09-15 12:14:17 +0200 |
commit | d1d43a62031431ec0fa28fb5cefaa56082f79da5 (patch) | |
tree | 13946d9d880b4bf499a59f0cc9d35e50cf33aee5 | |
parent | ed8983cb98fec755e0b633c4ec24a238d71182fc (diff) |
Crop selections to canvas.
-rw-r--r-- | src/canvastoolselections.cc | 4 |
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; |