@@ -119,8 +119,10 @@ const tickTexts = computed(() => {
119119const iRef = useTemplateRef (" i" )
120120function getPosition (event ) {
121121 let rect = iRef .value .getBoundingClientRect ()
122- let t = Math .trunc (event .clientY ) - rect .top - layout .top ,
123- b = rect .top + layout .top + layout .height - Math .trunc (event .clientY )
122+ let scaleY = rect .height / iRef .value .getBBox ().height
123+ let offsetY = event .clientY - rect .top
124+ let t = offsetY / scaleY - layout .top ,
125+ b = layout .top + layout .height - offsetY / scaleY
124126 let result = { t, b }
125127 let { x, y } = pos2coord ({ v: t })
126128 if (x) result .x = x
@@ -159,11 +161,13 @@ function axisMovePointerdown(e) {
159161 moveTimer = clearTimeout (moveTimer)
160162 let vmin0 = 0 , vmax0 = layout .height
161163 let boundary = coord2pos (act)
164+ let rect = iRef .value .getBoundingClientRect ()
165+ let scaleY = rect .height / iRef .value .getBBox ().height
162166 e .target .setPointerCapture (e .pointerId )
163167 e .target .onpointermove = (ev ) => {
164168 movementY += ev .movementY
165169 if (! pointerMoved) return
166- let dv = oob_squish_any (- movementY, { min: boundary .vmin - vmin0, max: boundary .vmax - vmax0 })
170+ let dv = oob_squish_any (- movementY / scaleY , { min: boundary .vmin - vmin0, max: boundary .vmax - vmax0 })
167171 let { xmin, xmax, ymin, ymax } = pos2coord ({ vmin: vmin0 + dv, vmax: vmax0 + dv })
168172 Object .assign (rangePreview, { xmin, xmax, ymin, ymax })
169173 }
@@ -191,12 +195,14 @@ function axisRescaleTopPointerdown(e) {
191195 min: coord2pos (act).vmin ,
192196 max: coord2pos ({ vmin: coord0 .vmax - mrv, vmax: coord0 .vmin + mrv }).vmin ,
193197 }
198+ let rect = iRef .value .getBoundingClientRect ()
199+ let scaleY = rect .height / iRef .value .getBBox ().height
194200 let movementY = 0
195201 e .target .setPointerCapture (e .pointerId )
196202 e .target .onpointermove = (ev ) => {
197203 movementY += ev .movementY
198204 let { xmin, xmax, ymin, ymax } = pos2coord ({
199- vmin: oob_squish_any (vmax - (vmax - vmin) * position .b / Math .max (position .b - movementY, 1 ), boundary),
205+ vmin: oob_squish_any (vmax - (vmax - vmin) * position .b / Math .max (position .b - movementY / scaleY , 1 ), boundary),
200206 vmax,
201207 })
202208 Object .assign (rangePreview, { xmin, xmax, ymin, ymax })
@@ -220,13 +226,15 @@ function axisRescaleBottomPointerdown(e) {
220226 min: coord2pos ({ vmin: coord0 .vmax - mrv, vmax: coord0 .vmin + mrv }).vmax ,
221227 max: coord2pos (act).vmax ,
222228 }
229+ let rect = iRef .value .getBoundingClientRect ()
230+ let scaleY = rect .height / iRef .value .getBBox ().height
223231 let movementY = 0
224232 e .target .setPointerCapture (e .pointerId )
225233 e .target .onpointermove = (ev ) => {
226234 movementY += ev .movementY
227235 let { xmin, xmax, ymin, ymax } = pos2coord ({
228236 vmin,
229- vmax: oob_squish_any (vmin + (vmax - vmin) * position .t / Math .max (position .t + movementY, 1 ), boundary),
237+ vmax: oob_squish_any (vmin + (vmax - vmin) * position .t / Math .max (position .t + movementY / scaleY , 1 ), boundary),
230238 })
231239 Object .assign (rangePreview, { xmin, xmax, ymin, ymax })
232240 }
0 commit comments