Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/jsvectormap/src/js/core/ drwxrwxr-x | |
| Viewing file: Select action/file-type: import EventHandler from "../eventHandler"
export default function bindContainerTouchEvents() {
let map = this,
touchStartScale,
touchStartDistance,
touchX,
touchY,
centerTouchX,
centerTouchY,
lastTouchesLength
let handleTouchEvent = e => {
var touches = e.touches,
offset,
scale,
transXOld,
transYOld
if (e.type == 'touchstart') {
lastTouchesLength = 0
}
if (touches.length == 1) {
if (lastTouchesLength == 1) {
transXOld = map.transX
transYOld = map.transY
map.transX -= (touchX - touches[0].pageX) / map.scale
map.transY -= (touchY - touches[0].pageY) / map.scale
map.tooltip.hide()
map.applyTransform()
if (transXOld != map.transX || transYOld != map.transY) {
e.preventDefault()
}
}
touchX = touches[0].pageX
touchY = touches[0].pageY
} else if (touches.length == 2) {
if (lastTouchesLength == 2) {
scale = Math.sqrt(
Math.pow(touches[0].pageX - touches[1].pageX, 2) +
Math.pow(touches[0].pageY - touches[1].pageY, 2)
) / touchStartDistance
map.setScale(touchStartScale * scale, centerTouchX, centerTouchY)
map.tooltip.hide()
e.preventDefault()
} else {
var rect = map.container.selector.getBoundingClientRect()
offset = {
top: rect.top + window.scrollY,
left: rect.left + window.scrollX,
}
if (touches[0].pageX > touches[1].pageX) {
centerTouchX = touches[1].pageX + (touches[0].pageX - touches[1].pageX) / 2
} else {
centerTouchX = touches[0].pageX + (touches[1].pageX - touches[0].pageX) / 2
}
if (touches[0].pageY > touches[1].pageY) {
centerTouchY = touches[1].pageY + (touches[0].pageY - touches[1].pageY) / 2
} else {
centerTouchY = touches[0].pageY + (touches[1].pageY - touches[0].pageY) / 2
}
centerTouchX -= offset.left
centerTouchY -= offset.top
touchStartScale = map.scale
touchStartDistance = Math.sqrt(
Math.pow(touches[0].pageX - touches[1].pageX, 2) +
Math.pow(touches[0].pageY - touches[1].pageY, 2)
)
}
}
lastTouchesLength = touches.length
}
EventHandler.on(map.container, 'touchstart', handleTouchEvent)
EventHandler.on(map.container, 'touchmove', handleTouchEvent)
} |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0055 ]-- |