Skip to content

AI-native design editor. Open-source Figma alternative.

fix(hit): replace non-null assertions with nullish coalescing

Danila Poyarkov909dc115ec59
diff --git a/packages/vue/src/Canvas/useCanvasInput.ts b/packages/vue/src/Canvas/useCanvasInput.ts
index 3d982bf97..694d2b4c4 100644
--- a/packages/vue/src/Canvas/useCanvasInput.ts
+++ b/packages/vue/src/Canvas/useCanvasInput.ts
@@ -207,7 +207,7 @@ export function useCanvasInput(
}
const abs = getAbsolutePositionFull(node, editor.graph)
- if (!hitTestCornerRotationByMatrix(cx, cy, node, editor.graph, editor.renderer?.zoom!)) {
+ if (!hitTestCornerRotationByMatrix(cx, cy, node, editor.graph, editor.renderer?.zoom ?? 1)) {
return false
}
const startAngle = Math.atan2(cy - abs.centerY, cx - abs.centerX) * (180 / Math.PI)
diff --git a/packages/vue/src/shared/input/select.ts b/packages/vue/src/shared/input/select.ts
index 24c2b8c75..b8e1c5886 100644
--- a/packages/vue/src/shared/input/select.ts
+++ b/packages/vue/src/shared/input/select.ts
@@ -438,7 +438,7 @@ export function updateHoverCursor(
const node = editor.graph.getNode(id)
if (!node) continue
- const handHit = getHitHandleByMatrix(cx, cy, node, editor.graph, editor?.renderer?.zoom!)
+ const handHit = getHitHandleByMatrix(cx, cy, node, editor.graph, editor.renderer?.zoom ?? 1)
if (handHit?.handle) {
cursor = buildResizeCursor(handHit?.rotation)
break
@@ -454,7 +454,7 @@ export function updateHoverCursor(
cy,
node,
editor.graph,
- editor?.renderer?.zoom!
+ editor.renderer?.zoom ?? 1
)
if (corner) {
const abRotation = getAbsoluteRotation(node, editor.graph)