vagran / dxf-viewer

DXF 2D viewer written in JavaScript
Mozilla Public License 2.0
310 stars 97 forks source link

Old orbitcontrols touches zoom issue #47

Closed dotoritos-kim closed 1 year ago

dotoritos-kim commented 1 year ago

In the old version of OrbitControls, when zooming in or zooming out with touches, it operates based on a strange point. I guess we'll have to find out where this is issue and fix it, or use the OrbitControls provided by the latest version of three.js.

vagran commented 1 year ago

There were some fixes in this control. Can you describe a particular problem you have encountered?

dotoritos-kim commented 1 year ago

이 컨트롤에 몇 가지 수정 사항이 있습니다. 발생한 특정 문제를 설명할 수 있습니까?

It is normal to zoom to the center of the two touch points. However, it is enlarged based on the upper left point, not the center of the two touch points.

vagran commented 1 year ago

OK, I see. It is not exactly upper left point, it depends on touch points positions, but seems the coordinates are somehow improperly transformed.

vagran commented 1 year ago

Fixed in master. The problem is related to high-density screens where window.devicePixelRatio is not 1. Note, that zoom center is locked when multitouch is started, and it is not changed after touch points moved (e.g. pan and zoom simultaneously), so this may be feeling not very convenient when simulataneously panned and zoomed. This not gonna be changed now. This legacy 3rd party code will be rewritten from scratch in the future.