--- a/svghmi/widget_scrollbar.ysl2 Sun Feb 14 05:15:13 2021 +0100
+++ b/svghmi/widget_scrollbar.ysl2 Sun Feb 14 05:17:25 2021 +0100
@@ -65,6 +65,13 @@
+ // get scrollbar -> root transform + let ctm = this.range_elt.getCTM(); + // relative motion -> discard translation + // root -> scrollbar transform + this.invctm = ctm.inverse(); svg_root.addEventListener("pointerup", this.bound_drop, true);
svg_root.addEventListener("pointermove", this.bound_drag, true);
@@ -77,9 +84,8 @@
let [size, maxh, range, pixels, units] = this.get_ratios();
- let matrix = this.range_elt.getCTM().inverse();
let point = new DOMPoint(e.movementX, e.movementY);
- let movement = point.matrixTransform(matrix).y;
+ let movement = point.matrixTransform(this.invctm).y; this.apply_position(this.position + movement * units / pixels);
--- a/tests/svghmi_scrollbar/svghmi_0@svghmi/svghmi.svg Sun Feb 14 05:15:13 2021 +0100
+++ b/tests/svghmi_scrollbar/svghmi_0@svghmi/svghmi.svg Sun Feb 14 05:17:25 2021 +0100
@@ -56,12 +56,12 @@
inkscape:document-units="px"
- inkscape:current-layer="g4507"
+ inkscape:current-layer="hmi0" - inkscape:cx="512.75649"
- inkscape:cy="208.59799"
+ inkscape:cx="318.22524" + inkscape:cy="196.09799" inkscape:window-width="1939"
inkscape:window-height="1243"
@@ -380,7 +380,7 @@
inkscape:label="HMI:Input@.size"
- transform="translate(80)">
+ transform="translate(80,100)"> style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
@@ -500,7 +500,7 @@
- transform="translate(80,-160)"
+ transform="translate(80,-60)" inkscape:label="HMI:Input@.range"
@@ -624,7 +624,7 @@
inkscape:label="HMI:Input@.position"
- transform="translate(80,-320)">
+ transform="translate(80,-220)"> style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ff0000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
@@ -745,7 +745,8 @@
- inkscape:label="HMI:ScrollBar@.position@.range@.size">
+ inkscape:label="HMI:ScrollBar@.position@.range@.size" + transform="translate(-202)"> @@ -790,19 +791,19 @@
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
- y="176.54129">Position</tspan></text>
+ y="276.54129">Position</tspan></text>
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
sodipodi:role="line">Range</tspan></text>
@@ -810,10 +811,81 @@
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
- y="496.54126">Size</tspan></text>
+ y="596.54126">Size</tspan></text> + inkscape:label="HMI:ScrollBar@.position@.range@.size" + transform="rotate(90,837.8103,-106.02497)"> + style="opacity:1;vector-effect:none;fill:#ff35ff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + inkscape:label="cursor" + style="opacity:1;vector-effect:none;fill:#3835ff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + inkscape:label="pageup" + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + d="M 1009.5,23 1047,81 H 972 Z" + style="opacity:1;vector-effect:none;fill:#3835ff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + inkscape:label="pagedown" + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + d="m 972,603 h 75 l -37.5,58 z" + style="opacity:1;vector-effect:none;fill:#3835ff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + transform="matrix(0.35355339,0.35355339,-0.35355339,0.35355339,831.43929,-136.17916)" + inkscape:label="HMI:ScrollBar@.position@.range@.size" + style="stroke-width:2"> + style="opacity:1;vector-effect:none;fill:#ff35ff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + inkscape:label="cursor" + style="opacity:1;vector-effect:none;fill:#3835ff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + inkscape:label="pageup" + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + d="M 1009.5,23 1047,81 H 972 Z" + style="opacity:1;vector-effect:none;fill:#3835ff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + inkscape:label="pagedown" + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" + d="m 972,603 h 75 l -37.5,58 z" + style="opacity:1;vector-effect:none;fill:#3835ff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />