fix: Distinguish subtype toggles from regular tools.

This commit is contained in:
Daniel J. Geiger 2023-11-22 11:19:34 -06:00
parent 00691631d8
commit 3aa1365acb
4 changed files with 20 additions and 8 deletions

View File

@ -17,7 +17,7 @@ import { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
import { capitalizeString, isTransparent } from "../utils"; import { capitalizeString, isTransparent } from "../utils";
import Stack from "./Stack"; import Stack from "./Stack";
import { ToolButton } from "./ToolButton"; import { ToolButton } from "./ToolButton";
import { SubtypeShapeActions, SubtypeToggles } from "./Subtypes"; import { SubtypeShapeActions } from "./Subtypes";
import { hasStrokeColor } from "../scene/comparisons"; import { hasStrokeColor } from "../scene/comparisons";
import { trackEvent } from "../analytics"; import { trackEvent } from "../analytics";
import { hasBoundTextElement, isTextElement } from "../element/typeChecks"; import { hasBoundTextElement, isTextElement } from "../element/typeChecks";
@ -342,7 +342,6 @@ export const ShapesSwitcher = ({
</DropdownMenu.Item> </DropdownMenu.Item>
</DropdownMenu.Content> </DropdownMenu.Content>
</DropdownMenu> </DropdownMenu>
<SubtypeToggles />
</> </>
); );
}; };

View File

@ -55,6 +55,7 @@ import "./Toolbar.scss";
import { mutateElement } from "../element/mutateElement"; import { mutateElement } from "../element/mutateElement";
import { ShapeCache } from "../scene/ShapeCache"; import { ShapeCache } from "../scene/ShapeCache";
import Scene from "../scene/Scene"; import Scene from "../scene/Scene";
import { SubtypeToggles } from "./Subtypes";
import { LaserPointerButton } from "./LaserTool/LaserPointerButton"; import { LaserPointerButton } from "./LaserTool/LaserPointerButton";
interface LayerUIProps { interface LayerUIProps {
@ -285,6 +286,7 @@ const LayerUI = ({
/> />
</Stack.Row> </Stack.Row>
</Island> </Island>
<SubtypeToggles />
{isCollaborating && ( {isCollaborating && (
<Island <Island
style={{ style={{

View File

@ -26,6 +26,7 @@ import { actionToggleStats } from "../actions";
import { HandButton } from "./HandButton"; import { HandButton } from "./HandButton";
import { isHandToolActive } from "../appState"; import { isHandToolActive } from "../appState";
import { useTunnels } from "../context/tunnels"; import { useTunnels } from "../context/tunnels";
import { SubtypeToggles } from "./Subtypes";
type MobileMenuProps = { type MobileMenuProps = {
appState: UIAppState; appState: UIAppState;
@ -91,6 +92,7 @@ export const MobileMenu = ({
/> />
</Stack.Row> </Stack.Row>
</Island> </Island>
<SubtypeToggles />
{renderTopRightUI && renderTopRightUI(true, appState)} {renderTopRightUI && renderTopRightUI(true, appState)}
<div className="mobile-misc-tools-container"> <div className="mobile-misc-tools-container">
{!appState.viewModeEnabled && ( {!appState.viewModeEnabled && (

View File

@ -17,6 +17,7 @@ import {
useExcalidrawSetAppState, useExcalidrawSetAppState,
} from "./App"; } from "./App";
import { ContextMenuItems } from "./ContextMenu"; import { ContextMenuItems } from "./ContextMenu";
import { Island } from "./Island";
export const SubtypeButton = ( export const SubtypeButton = (
subtype: Subtype, subtype: Subtype,
@ -145,12 +146,20 @@ export const SubtypeToggles = () => {
return ( return (
<> <>
<Island
style={{
marginLeft: 8,
alignSelf: "center",
height: "fit-content",
}}
>
{getSubtypeNames().map((subtype) => {getSubtypeNames().map((subtype) =>
am.renderAction( am.renderAction(
`custom.${subtype}`, `custom.${subtype}`,
hasAlwaysEnabledActions(subtype) ? { onContextMenu } : {}, hasAlwaysEnabledActions(subtype) ? { onContextMenu } : {},
), ),
)} )}
</Island>
</> </>
); );
}; };