diff -r 2637bb6a6bb0 -r 8388e6d4aa61 svghmi/widget_scrollbar.ysl2 --- 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) { switch(index) { case 0: - if (Math.round(this.position) != value) - this.position = value; + this.position = value; break; case 1: - this.range = value; + this.range = Math.max(1,value); break; case 2: this.size = 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); } on_page_click(is_up){ @@ -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; } drop(e) { @@ -86,7 +86,8 @@ if(pixels == 0) return; 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); } } ||