projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ruler: Add "Set as zero point" context menu entry
[pulseview.git]
/
pv
/
views
/
trace
/
view.cpp
diff --git
a/pv/views/trace/view.cpp
b/pv/views/trace/view.cpp
index fa911f0b5ad92ae8a27c0f96b3d69de2de984aab..79277b4e17074708b0f1e3718ef6eeb4996d2c93 100644
(file)
--- a/
pv/views/trace/view.cpp
+++ b/
pv/views/trace/view.cpp
@@
-495,9
+495,12
@@
const Timestamp& View::ruler_offset() const
return ruler_offset_;
}
return ruler_offset_;
}
-void View::set_zero_position(pv::util::Timestamp& position)
+void View::set_zero_position(
const
pv::util::Timestamp& position)
{
{
- ruler_shift_ = -position;
+ // ruler shift is a negative offset and the new zero position is relative
+ // to the current offset. Hence, we adjust the ruler shift only by the
+ // difference.
+ ruler_shift_ = -(position + (-ruler_shift_));
// Force an immediate update of the offsets
set_offset(offset_, true);
// Force an immediate update of the offsets
set_offset(offset_, true);