diff --git a/src/lib/board/Items/Item.jsx b/src/lib/board/Items/Item.jsx index 0d8ef1f..bdaa2ec 100644 --- a/src/lib/board/Items/Item.jsx +++ b/src/lib/board/Items/Item.jsx @@ -1,9 +1,11 @@ import React, { memo } from "react"; -import ResizeHandler from "./ResizeHandler"; import { css } from "goober"; import deepEqual from "fast-deep-equal"; +import ResizeHandler from "./ResizeHandler"; +import useMainStore from "../store/main"; + const itemClass = css` display: inline-block; transition: transform 150ms; @@ -184,6 +186,7 @@ const Item = ({ showResizeHandle = true, }) => { const itemWrapperRef = React.useRef(null); + const [uid] = useMainStore((state) => [state.config.uid]); const { component: Component = () => null, @@ -244,6 +247,7 @@ const Item = ({
{ getLinkedItems(getStoreItems(), getItemIds(), itemIds), posDelta ); - - updateItemExtent(); }, - [getItemIds, getStoreItems, moveStoreItems, updateItemExtent] + [getItemIds, getStoreItems, moveStoreItems] ); const putItemsOnTop = React.useCallback( @@ -292,7 +290,7 @@ const useItemActions = () => { }); insertItems(itemsWithPosition, beforeId); - placeItems(itemsToInsert.map((item) => item.id)); + placeItems(itemsToInsert.map(({ id }) => id)); }, [getCenter, insertItems, placeItems] ); diff --git a/src/lib/board/useDim.js b/src/lib/board/useDim.js index b134ecb..d620884 100644 --- a/src/lib/board/useDim.js +++ b/src/lib/board/useDim.js @@ -392,6 +392,12 @@ const useDim = () => { 200 ); + React.useEffect(() => { + window.debugUpdateExtent = () => updateItemExtent(); + window.debugDisplayExtent = () => + console.log(getConfiguration().itemExtent); + }, [getConfiguration, updateItemExtent]); + return { setDim: setDimSafe, rotateBoard, diff --git a/src/lib/index.js b/src/lib/index.js index 38d022c..d40c4f6 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -3,6 +3,7 @@ export { default as useWire } from "@/hooks/useWire"; export { default as useItems } from "@/board/Items/useItems"; export { default as useDebouncedItems } from "@/board/Items/useDebouncedItems"; export { default as useSelectedItems } from "@/board/Items/useSelectedItems"; +export { default as useGetSelectedItems } from "@/board/Items/useGetSelectedItems"; export { default as useItemActions } from "@/board/Items/useItemActions"; export { default as useItemInteraction } from "@/board/Items/useItemInteraction"; export { default as useAvailableActions } from "@/board/Items/useAvailableActions";