This commit is contained in:
Zsolt Viczian 2022-03-20 19:12:50 +01:00
parent c45433c8db
commit 4dec449516
3 changed files with 2 additions and 6 deletions

View File

@ -186,7 +186,6 @@ export const ShapesSwitcher = ({
setAppState, setAppState,
onImageAction, onImageAction,
appState, appState,
penDetected,
setDeviceType, setDeviceType,
}: { }: {
canvas: HTMLCanvasElement | null; canvas: HTMLCanvasElement | null;
@ -194,10 +193,9 @@ export const ShapesSwitcher = ({
setAppState: React.Component<any, AppState>["setState"]; setAppState: React.Component<any, AppState>["setState"];
onImageAction: (data: { pointerType: PointerType | null }) => void; onImageAction: (data: { pointerType: PointerType | null }) => void;
appState: AppState; appState: AppState;
penDetected: boolean;
setDeviceType: (obj: Partial<DeviceType>) => void; setDeviceType: (obj: Partial<DeviceType>) => void;
}) => { }) => {
const pd = useDeviceType().penDetected; const penDetected = useDeviceType().penDetected;
return ( return (
<> <>
{SHAPES.map(({ value, icon, key }, index) => { {SHAPES.map(({ value, icon, key }, index) => {
@ -220,7 +218,7 @@ export const ShapesSwitcher = ({
aria-keyshortcuts={shortcut} aria-keyshortcuts={shortcut}
data-testid={value} data-testid={value}
onChange={({ pointerType }) => { onChange={({ pointerType }) => {
if (!pd && pointerType === "pen") { if (!penDetected && pointerType === "pen") {
setAppState({ penMode: true }); setAppState({ penMode: true });
setDeviceType({ penDetected: true }); setDeviceType({ penDetected: true });
} }

View File

@ -360,7 +360,6 @@ const LayerUI = ({
insertOnCanvasDirectly: pointerType !== "mouse", insertOnCanvasDirectly: pointerType !== "mouse",
}); });
}} }}
penDetected={deviceType.penDetected}
setDeviceType={setDeviceType} setDeviceType={setDeviceType}
/> />
</Stack.Row> </Stack.Row>

View File

@ -85,7 +85,6 @@ export const MobileMenu = ({
insertOnCanvasDirectly: pointerType !== "mouse", insertOnCanvasDirectly: pointerType !== "mouse",
}); });
}} }}
penDetected={deviceType.penDetected}
setDeviceType={setDeviceType} setDeviceType={setDeviceType}
/> />
</Stack.Row> </Stack.Row>