mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
setDeviceType
This commit is contained in:
parent
7e7864ca3d
commit
53ba9dffd9
3 changed files with 23 additions and 8 deletions
|
@ -14,7 +14,7 @@ import {
|
|||
hasText,
|
||||
} from "../scene";
|
||||
import { SHAPES } from "../shapes";
|
||||
import { AppState, Zoom } from "../types";
|
||||
import { AppState, DeviceType, Zoom } from "../types";
|
||||
import { capitalizeString, isTransparent, setCursorForShape } from "../utils";
|
||||
import Stack from "./Stack";
|
||||
import { ToolButton } from "./ToolButton";
|
||||
|
@ -187,6 +187,7 @@ export const ShapesSwitcher = ({
|
|||
onImageAction,
|
||||
appState,
|
||||
penDetected,
|
||||
setDeviceType,
|
||||
}: {
|
||||
canvas: HTMLCanvasElement | null;
|
||||
elementType: AppState["elementType"];
|
||||
|
@ -194,6 +195,7 @@ export const ShapesSwitcher = ({
|
|||
onImageAction: (data: { pointerType: PointerType | null }) => void;
|
||||
appState: AppState;
|
||||
penDetected: boolean;
|
||||
setDeviceType: (obj: Partial<DeviceType>) => void;
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
|
@ -219,6 +221,7 @@ export const ShapesSwitcher = ({
|
|||
onChange={({ pointerType }) => {
|
||||
if (!penDetected && pointerType === "pen") {
|
||||
setAppState({ penMode: true });
|
||||
setDeviceType({ penDetected: true });
|
||||
}
|
||||
setAppState({
|
||||
elementType: value,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue