--- a/svghmi/widget_scrollbar.ysl2 Sun Feb 14 19:15:20 2021 +0100
+++ b/svghmi/widget_scrollbar.ysl2 Mon Feb 15 15:46:47 2021 +0100
@@ -12,11 +12,10 @@
dispatch(value,oldval, index) {
- if (Math.round(this.position) != value)
+ this.range = Math.max(1,value); @@ -55,8 +54,8 @@
apply_position(position){
- this.position = Math.max(Math.min(position, this.range), 0);
- this.apply_hmi_value(0, Math.round(this.position));
+ this.position = Math.round(Math.max(Math.min(position, this.range), 0)); + this.apply_hmi_value(0, this.position); @@ -74,6 +73,7 @@
this.invctm = ctm.inverse();
svg_root.addEventListener("pointerup", this.bound_drop, true);
svg_root.addEventListener("pointermove", this.bound_drag, true);
+ this.dragpos = this.position; @@ -86,7 +86,8 @@
let point = new DOMPoint(e.movementX, e.movementY);
let movement = point.matrixTransform(this.invctm).y;
- this.apply_position(this.position + movement * units / pixels);
+ this.dragpos += movement * units / pixels; + this.apply_position(this.dragpos);