fix build

This commit is contained in:
hamid zarghami
2026-05-10 08:53:17 +03:30
parent 25a5150b46
commit 9bedc5c06c
+15 -5
View File
@@ -1,4 +1,4 @@
import type Konva from "konva"; import Konva from "konva";
export type Guide = { export type Guide = {
id: string; id: string;
@@ -40,7 +40,15 @@ type RectBounds = {
type Axis = "x" | "y"; type Axis = "x" | "y";
const toRectBounds = (rect: Konva.IRect): RectBounds => { /** Matches Konva `getClientRect` / `IRect`. */
type BoundsRect = {
x: number;
y: number;
width: number;
height: number;
};
const toRectBounds = (rect: BoundsRect): RectBounds => {
const left = rect.x; const left = rect.x;
const top = rect.y; const top = rect.y;
const right = rect.x + rect.width; const right = rect.x + rect.width;
@@ -195,7 +203,9 @@ const collectEqualSpacingCandidates = (
return matches; return matches;
}; };
const findBestCandidate = (candidates: AxisSnapCandidate[]) => { const findBestCandidate = (
candidates: AxisSnapCandidate[],
): AxisSnapCandidate | null => {
let best: AxisSnapCandidate | null = null; let best: AxisSnapCandidate | null = null;
candidates.forEach((candidate) => { candidates.forEach((candidate) => {
if (isBetterCandidate(candidate, best)) { if (isBetterCandidate(candidate, best)) {
@@ -237,8 +247,8 @@ export const getSnappedPosition = (
const otherRects: RectBounds[] = []; const otherRects: RectBounds[] = [];
if (layer) { if (layer) {
layer layer
.find((candidate) => Boolean(candidate)) .find((candidate: Konva.Node) => Boolean(candidate))
.forEach((candidate) => { .forEach((candidate: Konva.Node) => {
if (candidate === node) return; if (candidate === node) return;
if (!candidate.draggable()) return; if (!candidate.draggable()) return;
if (!candidate.isVisible()) return; if (!candidate.isVisible()) return;