Merge pull request #4 from yoursunny/scroll

processing: preserve scroll position while zooming
This commit is contained in:
aster94
2019-01-04 17:04:04 +01:00
committed by GitHub

View File

@@ -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;