Skip to content

Commit 27abc6a

Browse files
committed
1 parent 587d852 commit 27abc6a

File tree

1 file changed

+3
-34
lines changed

1 file changed

+3
-34
lines changed

packages/excalidraw/components/Actions.tsx

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import clsx from "clsx";
2-
import { useRef, useState, useEffect } from "react";
2+
import { useRef, useState } from "react";
33
import * as Popover from "@radix-ui/react-popover";
44

55
import {
@@ -936,39 +936,8 @@ export const MobileShapeActions = ({
936936
const { container } = useExcalidrawContainer();
937937
const mobileActionsRef = useRef<HTMLDivElement>(null);
938938

939-
/** zsviczian #10253 */
940-
const [actionsWidth, setActionsWidth] = useState(0);
941-
942-
// Use useEffect to properly measure width after render
943-
useEffect(() => {
944-
const measureWidth = () => {
945-
if (mobileActionsRef.current) {
946-
const width = mobileActionsRef.current.getBoundingClientRect().width;
947-
if (width > 0) {
948-
setActionsWidth(width);
949-
}
950-
}
951-
};
952-
953-
measureWidth();
954-
955-
// Re-measure on resize if ResizeObserver is available
956-
if (typeof ResizeObserver !== "undefined") {
957-
const resizeObserver = new ResizeObserver(measureWidth);
958-
if (mobileActionsRef.current) {
959-
resizeObserver.observe(mobileActionsRef.current);
960-
}
961-
962-
return () => {
963-
resizeObserver.disconnect();
964-
};
965-
}
966-
}, []);
967-
968-
const ACTIONS_WIDTH = actionsWidth;
969-
//const ACTIONS_WIDTH =
970-
// mobileActionsRef.current?.getBoundingClientRect()?.width ?? 0;
971-
/* zsviczian end of insertation */
939+
const ACTIONS_WIDTH =
940+
mobileActionsRef.current?.getBoundingClientRect()?.width ?? 0;
972941

973942
// 7 actions + 2 for undo/redo
974943
const MIN_ACTIONS = 9;

0 commit comments

Comments
 (0)