Skip to content

Commit

Permalink
fix: incorrect background fill button active state (excalidraw#6491)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelle authored Apr 19, 2023
1 parent 98a77d7 commit eea30da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/actions/actionProperties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import {
isSomeElementSelected,
} from "../scene";
import { hasStrokeColor } from "../scene/comparisons";
import { arrayToMap } from "../utils";
import { arrayToMap, getShortcutKey } from "../utils";
import { register } from "./register";

const FONT_SIZE_RELATIVE_INCREASE_STEP = 0.1;
Expand Down Expand Up @@ -314,9 +314,9 @@ export const actionChangeFillStyle = register({
},
PanelComponent: ({ elements, appState, updateData }) => {
const selectedElements = getSelectedElements(elements, appState);
const allElementsZigZag = selectedElements.every(
(el) => el.fillStyle === "zigzag",
);
const allElementsZigZag =
selectedElements.length > 0 &&
selectedElements.every((el) => el.fillStyle === "zigzag");

return (
<fieldset>
Expand All @@ -326,7 +326,9 @@ export const actionChangeFillStyle = register({
options={[
{
value: "hachure",
text: t("labels.hachure"),
text: `${
allElementsZigZag ? t("labels.zigzag") : t("labels.hachure")
} (${getShortcutKey("Alt-Click")})`,
icon: allElementsZigZag ? FillZigZagIcon : FillHachureIcon,
active: allElementsZigZag ? true : undefined,
},
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"veryLarge": "Very large",
"solid": "Solid",
"hachure": "Hachure",
"zigzag": "Zigzag",
"crossHatch": "Cross-hatch",
"thin": "Thin",
"bold": "Bold",
Expand Down

0 comments on commit eea30da

Please sign in to comment.