diff --git a/src/components/canvas/Canvas.tsx b/src/components/canvas/Canvas.tsx
index 4f397d5..c81b9a1 100644
--- a/src/components/canvas/Canvas.tsx
+++ b/src/components/canvas/Canvas.tsx
@@ -13,7 +13,7 @@ import { ToolContext } from "@/context/Tool";
import { useTextures } from "@/hooks/useTextures";
import { useBlockData } from "@/hooks/useBlockData";
-import { confirmSelection, isInSelection } from "@/utils/selection";
+import * as selection from "@/utils/selection";
import * as clipboard from "@/utils/clipboard";
import Blocks from "./Blocks";
@@ -116,7 +116,7 @@ function Canvas() {
const updated = blocks.filter((block) => {
const withinRadius =
block.x >= radiusPosition.x && block.x < radiusPosition.x + radius && block.y >= radiusPosition.y && block.y < radiusPosition.y + radius;
- return !withinRadius || !isInSelection(selectionCoords, block.x, block.y);
+ return !withinRadius || !selection.isIn(selectionCoords, block.x, block.y);
});
setBlocks(updated);
@@ -142,7 +142,7 @@ function Canvas() {
setBlocks((prev) =>
prev.filter((b) => {
- const isSelected = isInSelection(selectionCoords, b.x, b.y);
+ const isSelected = selection.isIn(selectionCoords, b.x, b.y);
// Add blocks in the selection coords to the selection layer
if (isSelected) result.push(b);
@@ -197,7 +197,7 @@ function Canvas() {
const tileY = radiusPosition.y + y;
// Only add blocks within the selection
- if (isInSelection(selectionCoords, tileX, tileY)) {
+ if (selection.isIn(selectionCoords, tileX, tileY)) {
radiusBlocks.push({
name: selectedBlock,
x: tileX,
@@ -414,7 +414,7 @@ function Canvas() {
setSelectionLayerBlocks([]);
break;
case "Enter":
- confirmSelection(blocks, selectionLayerBlocks, setBlocks, setSelectionLayerBlocks);
+ selection.confirm(blocks, selectionLayerBlocks, setBlocks, setSelectionLayerBlocks);
break;
case " ": // Space
setDragging(true);
diff --git a/src/components/canvas/SelectionBar.tsx b/src/components/canvas/SelectionBar.tsx
index b421f57..5a60c1c 100644
--- a/src/components/canvas/SelectionBar.tsx
+++ b/src/components/canvas/SelectionBar.tsx
@@ -4,7 +4,7 @@ import { CheckIcon, XIcon } from "lucide-react";
import { CanvasContext } from "@/context/Canvas";
import { SelectionContext } from "@/context/Selection";
-import { confirmSelection } from "@/utils/selection";
+import * as selection from "@/utils/selection";
import { Button } from "@/components/ui/button";
@@ -29,7 +29,7 @@ function SelectionBar() {
Confirm selection?
-