setDeviceType

This commit is contained in:
Zsolt Viczian 2022-03-20 18:14:47 +01:00
parent 7e7864ca3d
commit 53ba9dffd9
3 changed files with 23 additions and 8 deletions

View file

@ -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,