|
1 | 1 | import clsx from "clsx"; |
2 | | -import { useRef, useState, useEffect } from "react"; |
| 2 | +import { useRef, useState } from "react"; |
3 | 3 | import * as Popover from "@radix-ui/react-popover"; |
4 | 4 |
|
5 | 5 | import { |
@@ -936,39 +936,8 @@ export const MobileShapeActions = ({ |
936 | 936 | const { container } = useExcalidrawContainer(); |
937 | 937 | const mobileActionsRef = useRef<HTMLDivElement>(null); |
938 | 938 |
|
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; |
972 | 941 |
|
973 | 942 | // 7 actions + 2 for undo/redo |
974 | 943 | const MIN_ACTIONS = 9; |
|
0 commit comments