Skip to content
Snippets Groups Projects
Commit efb50b61 authored by David Sehnal's avatar David Sehnal
Browse files

attempt to make zooming work on iOS Safari

parent 4d493596
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@
-webkit-user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
touch-action: manipulation;
}
.msp-viewport-controls {
......
......@@ -39,7 +39,8 @@ function getButtons(event: MouseEvent | Touch) {
export const DefaultInputObserverProps = {
noScroll: true,
noContextMenu: true
noContextMenu: true,
noPinchZoom: true
}
export type InputObserverProps = Partial<typeof DefaultInputObserverProps>
......@@ -160,7 +161,7 @@ interface InputObserver {
namespace InputObserver {
export function create (element: Element, props: InputObserverProps = {}): InputObserver {
let { noScroll, noContextMenu } = { ...DefaultInputObserverProps, ...props }
let { noScroll, noContextMenu, noPinchZoom } = { ...DefaultInputObserverProps, ...props }
let lastTouchDistance = 0
const pointerDown = Vec2.zero()
......@@ -336,6 +337,15 @@ namespace InputObserver {
}
function onTouchMove (ev: TouchEvent) {
if (noPinchZoom) {
ev.preventDefault();
ev.stopPropagation();
if ((ev as any).originalEvent) {
(ev as any).originalEvent.preventDefault();
(ev as any).originalEvent.stopPropagation();
}
}
if (ev.touches.length === 1) {
buttons = ButtonsType.Flag.Primary
onPointerMove(ev.touches[0])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment