From d9f49ffd67f2c5e01e18c7c8b7e11d13ab3251c5 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Mon, 28 Feb 2022 11:08:28 +0530 Subject: [PATCH] fix: Don't show align icons for single bound container element (#4846) * fix: Don't show align icons for single bound container element * check 2nd element as well --- src/components/Actions.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/Actions.tsx b/src/components/Actions.tsx index 65c10a6a..d1f9a780 100644 --- a/src/components/Actions.tsx +++ b/src/components/Actions.tsx @@ -19,6 +19,7 @@ import { capitalizeString, isTransparent, setCursorForShape } from "../utils"; import Stack from "./Stack"; import { ToolButton } from "./ToolButton"; import { hasStrokeColor } from "../scene/comparisons"; +import { hasBoundTextElement } from "../element/typeChecks"; export const SelectedShapeActions = ({ appState, @@ -35,6 +36,15 @@ export const SelectedShapeActions = ({ getNonDeletedElements(elements), appState, ); + + let isSingleElementBoundContainer = false; + if ( + targetElements.length === 2 && + (hasBoundTextElement(targetElements[0]) || + hasBoundTextElement(targetElements[1])) + ) { + isSingleElementBoundContainer = true; + } const isEditing = Boolean(appState.editingElement); const isMobile = useIsMobile(); const isRTL = document.documentElement.getAttribute("dir") === "rtl"; @@ -117,7 +127,7 @@ export const SelectedShapeActions = ({ - {targetElements.length > 1 && ( + {targetElements.length > 1 && !isSingleElementBoundContainer && (
{t("labels.align")}