Continuing to re-plug the handlers.
This commit is contained in:
1 parent
eb1618d009
commit
8deed17b05
2 files changed
+38
-17
No files matched your search
@@ -81,10 +81,10 @@ export const Handlers: react.FC<HandlersProperties> = (
|
||||
if (
|
||||
mouseState.current.down &&
|
||||
Date.now() - mouseState.current.timestamp >
|
||||
handlersConfig.mouseMoveThrottleDelay &&
|
||||
handlersConfig.mouseMoveThrottleDelay /* &&
|
||||
(event.clientX - mouseState.current.starting.x) ** 2 +
|
||||
(event.clientY - mouseState.current.starting.y) ** 2 >
|
||||
100
|
||||
100 */
|
||||
) {
|
||||
genericHandler(event);
|
||||
if (mouseState.current.down) {
|
||||
@@ -227,15 +227,6 @@ export const Handlers: react.FC<HandlersProperties> = (
|
||||
);
|
||||
const factor = newDistance / touchState.current.distance;
|
||||
// console.log(`+++++++++ ZOOM Factor is ${factor} ++++++++++`);
|
||||
touchState.current = {
|
||||
state: 'double',
|
||||
touches: [
|
||||
{ x: event.touches[0].screenX, y: event.touches[0].screenY },
|
||||
{ x: event.touches[1].screenX, y: event.touches[1].screenY },
|
||||
],
|
||||
distance: newDistance,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
const previousCenter = {
|
||||
x:
|
||||
(touchState.current.touches[0].x +
|
||||
@@ -257,10 +248,19 @@ export const Handlers: react.FC<HandlersProperties> = (
|
||||
},
|
||||
deltaZoom: factor,
|
||||
zoomCenter: {
|
||||
x: currentCenter.x - previousCenter.x,
|
||||
y: currentCenter.y - previousCenter.y,
|
||||
x: (currentCenter.x + previousCenter.x) / 2,
|
||||
y: (currentCenter.y + previousCenter.y) / 2,
|
||||
},
|
||||
});
|
||||
touchState.current = {
|
||||
state: 'double',
|
||||
touches: [
|
||||
{ x: event.touches[0].screenX, y: event.touches[0].screenY },
|
||||
{ x: event.touches[1].screenX, y: event.touches[1].screenY },
|
||||
],
|
||||
distance: newDistance,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
}
|
||||
} else if (
|
||||
touchState.current.state === 'pointer' &&
|
||||
|
||||
Reference in new issue
Block a user