mirror of
https://github.com/aster94/logic-analyzer.git
synced 2026-05-02 08:35:21 +03:00
processing: preserve scroll position while zooming
This commit makes the Processing program preserve the scroll position relative to timestamp, when the user is zooming in/out the graph. Effectively, the left edge of the visible window always represents the same timestamp, so that the user doesn't have to search for the interesting region again after zooming.
This commit is contained in:
@@ -312,8 +312,10 @@ void mouseWheel(MouseEvent event) {
|
|||||||
if (mouseY>buttonY && mouseY <buttonY+buttonH &&
|
if (mouseY>buttonY && mouseY <buttonY+buttonH &&
|
||||||
mouseX>button4X && mouseX <button4X+smallButtonW) {
|
mouseX>button4X && mouseX <button4X+smallButtonW) {
|
||||||
//it is over the reducer button
|
//it is over the reducer button
|
||||||
|
xShift *= reducer;
|
||||||
reducer-= wheel/10;
|
reducer-= wheel/10;
|
||||||
reducer = constrain(reducer, 0.1, 9.9);
|
reducer = constrain(reducer, 0.1, 9.9);
|
||||||
|
xShift /= reducer; // preserve scroll position
|
||||||
getData();
|
getData();
|
||||||
} else { //move the graph
|
} else { //move the graph
|
||||||
xShift-=wheel*50;
|
xShift-=wheel*50;
|
||||||
|
|||||||
Reference in New Issue
Block a user