mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-17 03:04:26 +01:00
fix active tool type
This commit is contained in:
@@ -200,7 +200,9 @@ export const MobileToolBar = ({
|
||||
(tool) => tool.type === app.defaultSelectionTool,
|
||||
) || SELECTION_TOOLS[0]
|
||||
}
|
||||
isActive={(type: string) => type === "lasso" || type === "selection"}
|
||||
isActive={
|
||||
activeTool.type === "selection" || activeTool.type === "lasso"
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Free Draw */}
|
||||
@@ -257,9 +259,7 @@ export const MobileToolBar = ({
|
||||
SHAPE_TOOLS.find((tool) => tool.type === lastActiveGenericShape) ||
|
||||
SHAPE_TOOLS[0]
|
||||
}
|
||||
isActive={(type: string) =>
|
||||
["rectangle", "diamond", "ellipse"].includes(type)
|
||||
}
|
||||
isActive={["rectangle", "diamond", "ellipse"].includes(activeTool.type)}
|
||||
/>
|
||||
|
||||
{/* Arrow/Line */}
|
||||
@@ -288,7 +288,7 @@ export const MobileToolBar = ({
|
||||
(tool) => tool.type === lastActiveLinearElement,
|
||||
) || LINEAR_ELEMENT_TOOLS[0]
|
||||
}
|
||||
isActive={(type: string) => ["arrow", "line"].includes(type)}
|
||||
isActive={["arrow", "line"].includes(activeTool.type)}
|
||||
/>
|
||||
|
||||
{/* Image */}
|
||||
|
||||
@@ -132,7 +132,7 @@ type ToolWithPopupProps = {
|
||||
"data-testid": string;
|
||||
onToolChange: (type: string) => void;
|
||||
getDisplayedOption: () => ToolOption;
|
||||
isActive: (type: string) => boolean;
|
||||
isActive: boolean;
|
||||
fillable?: boolean;
|
||||
};
|
||||
|
||||
@@ -154,7 +154,6 @@ export const ToolWithPopup = ({
|
||||
const [triggerRef, setTriggerRef] = useState<HTMLElement | null>(null);
|
||||
|
||||
const displayedOption = getDisplayedOption();
|
||||
const isToolActive = options.some((option) => isActive(option.type));
|
||||
|
||||
return (
|
||||
<div style={{ position: "relative" }}>
|
||||
@@ -163,7 +162,7 @@ export const ToolWithPopup = ({
|
||||
className={clsx(className, { fillable })}
|
||||
type="radio"
|
||||
icon={displayedOption.icon}
|
||||
checked={isToolActive}
|
||||
checked={isActive}
|
||||
name="editor-current-shape"
|
||||
title={title}
|
||||
aria-label={title}
|
||||
|
||||
Reference in New Issue
Block a user