From e31ad4a6638904343816b1c80645d4492da7f9d7 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Wed, 27 Nov 2024 10:36:24 +0000 Subject: [PATCH] fix: update dragOffset fixed --- .../smartsheet/calendar/WeekView/DateField.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue index 58df7737ad..4da4f2966e 100644 --- a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue @@ -416,6 +416,11 @@ const dragStart = (event: MouseEvent, record: Row) => { isDragging.value = false + dragOffset.value = { + x: event.clientX - target.getBoundingClientRect().left, + y: event.clientY - target.getBoundingClientRect().top, + } + dragTimeout.value = setTimeout(() => { if (!isUIAllowed('dataEdit')) return isDragging.value = true @@ -423,11 +428,6 @@ const dragStart = (event: MouseEvent, record: Row) => { target = target.parentElement as HTMLElement } - dragOffset.value = { - x: event.clientX - target.getBoundingClientRect().left, - y: event.clientY - target.getBoundingClientRect().top, - } - const allRecords = document.querySelectorAll('.draggable-record') allRecords.forEach((el) => { if (!el.getAttribute('data-unique-id').includes(record.rowMeta.id!)) { @@ -445,6 +445,12 @@ const dragStart = (event: MouseEvent, record: Row) => { const onMouseUp = () => { clearTimeout(dragTimeout.value!) + + dragOffset.value = { + x: null, + y: null, + } + document.removeEventListener('mouseup', onMouseUp) if (!isDragging.value) { emits('expandRecord', record)