diff --git a/src/components/canvas/Canvas.tsx b/src/components/canvas/Canvas.tsx
index f67c739..5ee5878 100644
--- a/src/components/canvas/Canvas.tsx
+++ b/src/components/canvas/Canvas.tsx
@@ -25,8 +25,6 @@ import { usePaintBucketTool } from "@/hooks/tools/paint-bucket";
import { useEyedropperTool } from "@/hooks/tools/eyedropper";
import { useZoomTool } from "@/hooks/tools/zoom";
-import * as selection from "@/utils/selection";
-
import Blocks from "./Blocks";
import Cursor from "./Cursor";
import Selection from "./Selection";
@@ -43,7 +41,7 @@ PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;
function Canvas() {
const { stageSize, canvasSize, blocks, coords, scale, version, setStageSize, setBlocks, setCoords, setScale } = useContext(CanvasContext);
const { addHistory, undo, redo } = useContext(HistoryContext);
- const { selectionCoords, selectionLayerBlocks, setSelectionCoords, setSelectionLayerBlocks } = useContext(SelectionContext);
+ const { selectionCoords, selectionLayerBlocks, setSelectionCoords, setSelectionLayerBlocks, confirmSelection } = useContext(SelectionContext);
const { settings } = useContext(SettingsContext);
const { missingTexture } = useContext(TexturesContext);
const { isDark } = useContext(ThemeContext);
@@ -250,7 +248,7 @@ function Canvas() {
setSelectionLayerBlocks([]);
break;
case "Enter":
- selection.confirm(blocks, selectionLayerBlocks, setBlocks, setSelectionLayerBlocks);
+ confirmSelection();
break;
case " ": // Space
setDragging(true);
diff --git a/src/components/canvas/SelectionBar.tsx b/src/components/canvas/SelectionBar.tsx
index 79ea1a8..6fcfa78 100644
--- a/src/components/canvas/SelectionBar.tsx
+++ b/src/components/canvas/SelectionBar.tsx
@@ -1,16 +1,12 @@
import { useContext, useEffect, useState } from "react";
import { CheckIcon, XIcon } from "lucide-react";
-import { CanvasContext } from "@/context/Canvas";
import { SelectionContext } from "@/context/Selection";
-import * as selection from "@/utils/selection";
-
import { Button } from "@/components/ui/button";
function SelectionBar() {
- const { blocks, setBlocks } = useContext(CanvasContext);
- const { selectionLayerBlocks, setSelectionLayerBlocks } = useContext(SelectionContext);
+ const { selectionLayerBlocks, setSelectionLayerBlocks, confirmSelection } = useContext(SelectionContext);
const [isVisible, setIsVisible] = useState(false);
@@ -29,7 +25,7 @@ function SelectionBar() {
Confirm selection?
-