Browse Source

fix: column dragoffset correction

pull/9901/head
DarkPhoenix2704 4 days ago
parent
commit
93f3ca379e
  1. 8
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue

8
packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue

@ -301,9 +301,6 @@ const dragOffset = ref<{
const calculateNewRow = (event: MouseEvent, updateSideBarData?: boolean) => { const calculateNewRow = (event: MouseEvent, updateSideBarData?: boolean) => {
const { width, left } = container.value?.getBoundingClientRect() const { width, left } = container.value?.getBoundingClientRect()
// Calculate the percentage of the width based on the mouse position
// This is used to calculate the day index
const relativeX = event.clientX - left const relativeX = event.clientX - left
/* if (dragOffset.value.x && dragRecord.value?.rowMeta.spanningDays === 1) { /* if (dragOffset.value.x && dragRecord.value?.rowMeta.spanningDays === 1) {
@ -318,8 +315,9 @@ const calculateNewRow = (event: MouseEvent, updateSideBarData?: boolean) => {
if (!fromCol) return { updatedProperty: [], newRow: null } if (!fromCol) return { updatedProperty: [], newRow: null }
// Calculate the day index based on the percentage of the width // Calculate the day index based on the percentage of the width
const day = Math.floor(
const day = Math.floor(percentX * maxVisibleDays.value) - dragRecord.value.rowMeta.spanningDays percentX * maxVisibleDays.value - dragRecord.value.rowMeta.spanningDays - Math.max(0, Math.min(1, relativeX / width)),
)
// Calculate the new start date based on the day index by adding the day index to the start date of the selected date range // Calculate the new start date based on the day index by adding the day index to the start date of the selected date range
const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day') const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day')

Loading…
Cancel
Save