Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: incorrect background fill button active state (#6491)

David Luzareea30da05a58
diff --git a/src/actions/actionProperties.tsx b/src/actions/actionProperties.tsx
index ed714816b6..382e964b9c 100644
--- a/src/actions/actionProperties.tsx
+++ b/src/actions/actionProperties.tsx
@@ -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;
@@ -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>
@@ -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,
},
diff --git a/src/locales/en.json b/src/locales/en.json
index 8752d415aa..7e250a800e 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -54,6 +54,7 @@
"veryLarge": "Very large",
"solid": "Solid",
"hachure": "Hachure",
+ "zigzag": "Zigzag",
"crossHatch": "Cross-hatch",
"thin": "Thin",
"bold": "Bold",