projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c974355
)
Viewport: Use fabs instead of branch
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sun, 28 Dec 2014 21:00:33 +0000
(21:00 +0000)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Mon, 29 Dec 2014 12:24:23 +0000
(12:24 +0000)
pv/view/viewport.cpp
patch
|
blob
|
history
diff --git
a/pv/view/viewport.cpp
b/pv/view/viewport.cpp
index 971eb755228f978a1355677adbfb9d6f5668615d..0e89f3ad96fc6b983d3ed1d9d8fe2cb495e59f2b 100644
(file)
--- a/
pv/view/viewport.cpp
+++ b/
pv/view/viewport.cpp
@@
-92,9
+92,8
@@
bool Viewport::touch_event(QTouchEvent *event)
double w = touchPoint1.pos().x() - touchPoint0.pos().x();
if (abs(w) >= 1.0) {
- double scale = (pinch_offset1_ - pinch_offset0_) / w;
- if (scale < 0)
- scale = -scale;
+ const double scale =
+ fabs((pinch_offset1_ - pinch_offset0_) / w);
double offset = pinch_offset0_ - touchPoint0.pos().x() * scale;
if (scale > 0)
view_.set_scale_offset(scale, offset);