fix: slider position error when zoom is not 1 #227
parent
46b71b2e0a
commit
90d33b019b
|
@ -35,11 +35,19 @@ export function getPrecision (step) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMousePosition (vertical, e) {
|
export function getMousePosition (vertical, e) {
|
||||||
return vertical ? e.clientY : e.pageX
|
let zoom = 1
|
||||||
|
if (window.visualViewport) {
|
||||||
|
zoom = +(window.visualViewport.width / document.body.getBoundingClientRect().width).toFixed(2)
|
||||||
|
}
|
||||||
|
return (vertical ? e.clientY : e.pageX) / zoom
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTouchPosition (vertical, e) {
|
export function getTouchPosition (vertical, e) {
|
||||||
return vertical ? e.touches[0].clientY : e.touches[0].pageX
|
let zoom = 1
|
||||||
|
if (window.visualViewport) {
|
||||||
|
zoom = +(window.visualViewport.width / document.body.getBoundingClientRect().width).toFixed(2)
|
||||||
|
}
|
||||||
|
return (vertical ? e.touches[0].clientY : e.touches[0].pageX) / zoom
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getHandleCenterPosition (vertical, handle) {
|
export function getHandleCenterPosition (vertical, handle) {
|
||||||
|
|
Loading…
Reference in New Issue