The native js on the mobile terminal realizes the picture scaling effect. How to solve the problem that the zoom ratio changes too much?

problem description

touchmovetransform:scale23

related codes

// 
function zoom(tInfo){
  // 
  var ratio = 
    // touchmove
    getHypotenuseLength(
      tInfo.zoomCurrentTouches[0].clientX,
      tInfo.zoomCurrentTouches[0].clientY,
      tInfo.zoomCurrentTouches[1].clientX,
      tInfo.zoomCurrentTouches[1].clientY) /
    // touchstart
    getHypotenuseLength(
      tInfo.zoomStartTouches[0].clientX,
      tInfo.zoomStartTouches[0].clientY,
      tInfo.zoomStartTouches[1].clientX,
      tInfo.zoomStartTouches[1].clientY)
  
  // 
  this.currentItem.style.transform = "scale("+ ratio +")"
}

// 
function getHypotenuseLength(x1, y1, x2, y2){
  var sideW = x1 - x2
  var sideH = y1 - y2
  return Math.sqrt((sideW * sideW) + (sideH * sideH))
}
Jun.22,2022

just adjust the zoom by yourself.

// 
  this.currentItem.style.transform = 'scale('+ ratio / 10 +')'
Try dividing

by 10.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ba2a00-2ee64.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ba2a00-2ee64.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?