fix: height issues in open image dialog

This commit is contained in:
trafficlunar 2024-12-28 20:35:13 +00:00
parent 25f519074a
commit cf83d2fc7c
2 changed files with 5 additions and 7 deletions

View file

@ -24,7 +24,7 @@ function BlockSelector({ stageWidth, searchInput, selectedBlocks, setSelectedBlo
const [hoverPosition, setHoverPosition] = useState<Position | null>(null);
const filteredBlocks = useMemo(() => Object.keys(blockData).filter((value) => value.includes(searchInput)), [searchInput, blockData]);
const blocksPerColumn = Math.floor(462 / (32 + 2));
const blocksPerColumn = Math.floor(stageWidth / (32 + 2));
const onClick = (block: string) => {
if (selectedBlocks.includes(block)) {
@ -36,7 +36,7 @@ function BlockSelector({ stageWidth, searchInput, selectedBlocks, setSelectedBlo
return (
<Stage
width={462}
width={stageWidth}
height={Math.ceil(Object.keys(blockData).length / blocksPerColumn) * (32 + 2)}
options={{ backgroundAlpha: 0 }}
onMouseLeave={() => setHoverPosition(null)}