fix: drawing-tablet stylus touch events being prevented (#7494)
This commit is contained in:
parent
c72e853c85
commit
d19b51d4f8
@ -67,7 +67,6 @@ import {
|
|||||||
GRID_SIZE,
|
GRID_SIZE,
|
||||||
IMAGE_MIME_TYPES,
|
IMAGE_MIME_TYPES,
|
||||||
IMAGE_RENDER_TIMEOUT,
|
IMAGE_RENDER_TIMEOUT,
|
||||||
isAndroid,
|
|
||||||
isBrave,
|
isBrave,
|
||||||
LINE_CONFIRM_THRESHOLD,
|
LINE_CONFIRM_THRESHOLD,
|
||||||
MAX_ALLOWED_FILE_BYTES,
|
MAX_ALLOWED_FILE_BYTES,
|
||||||
@ -90,6 +89,7 @@ import {
|
|||||||
POINTER_EVENTS,
|
POINTER_EVENTS,
|
||||||
TOOL_TYPE,
|
TOOL_TYPE,
|
||||||
EDITOR_LS_KEYS,
|
EDITOR_LS_KEYS,
|
||||||
|
isIOS,
|
||||||
} from "../constants";
|
} from "../constants";
|
||||||
import { ExportedElements, exportCanvas, loadFromBlob } from "../data";
|
import { ExportedElements, exportCanvas, loadFromBlob } from "../data";
|
||||||
import Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
import Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
||||||
@ -2756,9 +2756,8 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onTouchStart = (event: TouchEvent) => {
|
private onTouchStart = (event: TouchEvent) => {
|
||||||
// fix for Apple Pencil Scribble
|
// fix for Apple Pencil Scribble (do not prevent for other devices)
|
||||||
// On Android, preventing the event would disable contextMenu on tap-hold
|
if (isIOS) {
|
||||||
if (!isAndroid) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2783,9 +2782,6 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
didTapTwice = false;
|
didTapTwice = false;
|
||||||
clearTimeout(tappedTwiceTimer);
|
clearTimeout(tappedTwiceTimer);
|
||||||
}
|
}
|
||||||
if (isAndroid) {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.touches.length === 2) {
|
if (event.touches.length === 2) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -13,6 +13,10 @@ export const isFirefox =
|
|||||||
export const isChrome = navigator.userAgent.indexOf("Chrome") !== -1;
|
export const isChrome = navigator.userAgent.indexOf("Chrome") !== -1;
|
||||||
export const isSafari =
|
export const isSafari =
|
||||||
!isChrome && navigator.userAgent.indexOf("Safari") !== -1;
|
!isChrome && navigator.userAgent.indexOf("Safari") !== -1;
|
||||||
|
export const isIOS =
|
||||||
|
/iPad|iPhone/.test(navigator.platform) ||
|
||||||
|
// iPadOS 13+
|
||||||
|
(navigator.userAgent.includes("Mac") && "ontouchend" in document);
|
||||||
// keeping function so it can be mocked in test
|
// keeping function so it can be mocked in test
|
||||||
export const isBrave = () =>
|
export const isBrave = () =>
|
||||||
(navigator as any).brave?.isBrave?.name === "isBrave";
|
(navigator as any).brave?.isBrave?.name === "isBrave";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user