Skip to content

Commit 81333f0

Browse files
fix(cientos): cancel decal edit when handle is released off-mesh
1 parent 88ac6b6 commit 81333f0

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

  • packages/cientos/src/core/abstractions/Decal/DebugUI

‎packages/cientos/src/core/abstractions/Decal/DebugUI/Handle.vue‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { DECAL_DEBUG_KEY } from './context'
1111
1212
const ctx = inject(DECAL_DEBUG_KEY)
1313
if (!ctx) { throw new Error('[DecalDebugUI] Handle.vue requires the DecalDebugUI context.') }
14-
const { session, isSnapEnabled, snapAngleDeg, rootRef, commit, cancel } = ctx
14+
const { session, isSnapEnabled, snapAngleDeg, rootRef, cancel } = ctx
1515
1616
const MIN_SCALE = 0.25
1717
const MAX_SCALE = 3.5
@@ -27,8 +27,6 @@ const isSliderDragging = ref(false)
2727
const dragCenter = reactive({ x: 0, y: 0, radius: 0 })
2828
2929
const isEditing = computed(() => !!session.value?.editingEntry.value)
30-
const editingMode = computed(() => session.value?.editingMode.value ?? null)
31-
const isUpdating = computed(() => editingMode.value === 'update')
3230
const isDraggingTexture = computed(() => session.value?.dragTextureIndex.value !== null)
3331
const editingZIndex = computed(() => session.value?.editingEntry.value?.zIndex ?? null)
3432
@@ -57,11 +55,10 @@ const { x: xDrag, y: yDrag } = useDraggable(dragRef, {
5755
const s = session.value
5856
if (!s) { return }
5957
s.setUiDragging(false)
60-
// Released off-mesh: commit if updating, cancel if creating.
61-
if (!s.isCursorOnTarget.value) {
62-
if (isUpdating.value) { commit() }
63-
else { cancel() }
64-
}
58+
// Off-mesh release has no valid raycast point — cancel in both modes
59+
// so the decal doesn't land at a garbage position the user can't see.
60+
// (Update reverts to backup, create drops the pending placement.)
61+
if (!s.isCursorOnTarget.value) { cancel() }
6562
},
6663
})
6764

0 commit comments

Comments
 (0)