disable touble-tap-to-create-text on mobile
This commit is contained in:
parent
9d0b7b0f2c
commit
bf7810306c
@ -1204,13 +1204,16 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
// event.touches.length === 1 will also prevent inserting text when user's zooming
|
// event.touches.length === 1 will also prevent inserting text when user's zooming
|
||||||
if (didTapTwice && event.touches.length === 1) {
|
if (didTapTwice && event.touches.length === 1) {
|
||||||
const [touch] = event.touches;
|
const [touch] = event.touches;
|
||||||
this.handleCanvasDoubleClick({
|
this.handleCanvasDoubleClick(
|
||||||
|
{
|
||||||
clientX: touch.clientX,
|
clientX: touch.clientX,
|
||||||
clientY: touch.clientY,
|
clientY: touch.clientY,
|
||||||
ctrlKey: false,
|
ctrlKey: false,
|
||||||
metaKey: false,
|
metaKey: false,
|
||||||
altKey: false,
|
altKey: false,
|
||||||
});
|
},
|
||||||
|
false,
|
||||||
|
);
|
||||||
didTapTwice = false;
|
didTapTwice = false;
|
||||||
clearTimeout(tappedTwiceTimer);
|
clearTimeout(tappedTwiceTimer);
|
||||||
}
|
}
|
||||||
@ -1882,6 +1885,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
sceneX,
|
sceneX,
|
||||||
sceneY,
|
sceneY,
|
||||||
insertAtParentCenter = true,
|
insertAtParentCenter = true,
|
||||||
|
createTextIfNotExists = true,
|
||||||
}: {
|
}: {
|
||||||
/** X position to insert text at */
|
/** X position to insert text at */
|
||||||
sceneX: number;
|
sceneX: number;
|
||||||
@ -1889,9 +1893,14 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
sceneY: number;
|
sceneY: number;
|
||||||
/** whether to attempt to insert at element center if applicable */
|
/** whether to attempt to insert at element center if applicable */
|
||||||
insertAtParentCenter?: boolean;
|
insertAtParentCenter?: boolean;
|
||||||
|
createTextIfNotExists?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const existingTextElement = this.getTextElementAtPosition(sceneX, sceneY);
|
const existingTextElement = this.getTextElementAtPosition(sceneX, sceneY);
|
||||||
|
|
||||||
|
if (!existingTextElement && !createTextIfNotExists) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const parentCenterPosition =
|
const parentCenterPosition =
|
||||||
insertAtParentCenter &&
|
insertAtParentCenter &&
|
||||||
this.getTextWysiwygSnappedToCenterPosition(
|
this.getTextWysiwygSnappedToCenterPosition(
|
||||||
@ -1967,6 +1976,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
React.PointerEvent<HTMLCanvasElement>,
|
React.PointerEvent<HTMLCanvasElement>,
|
||||||
"clientX" | "clientY" | "ctrlKey" | "metaKey" | "altKey"
|
"clientX" | "clientY" | "ctrlKey" | "metaKey" | "altKey"
|
||||||
>,
|
>,
|
||||||
|
createTextIfNotExists = true,
|
||||||
) => {
|
) => {
|
||||||
// case: double-clicking with arrow/line tool selected would both create
|
// case: double-clicking with arrow/line tool selected would both create
|
||||||
// text and enter multiElement mode
|
// text and enter multiElement mode
|
||||||
@ -2037,6 +2047,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
sceneX,
|
sceneX,
|
||||||
sceneY,
|
sceneY,
|
||||||
insertAtParentCenter: !event.altKey,
|
insertAtParentCenter: !event.altKey,
|
||||||
|
createTextIfNotExists,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user