From d1d43a62031431ec0fa28fb5cefaa56082f79da5 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 15 Sep 2018 12:14:17 +0200 Subject: Crop selections to canvas. --- src/canvastoolselections.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/canvastoolselections.cc') 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; -- cgit v1.2.3