Browse Source

fix(nc-gui): auto scroll down, if mouse end of window

pull/7611/head
DarkPhoenix2704 10 months ago
parent
commit
b1c5f6c4a6
  1. 16
      packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue

16
packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue

@ -203,21 +203,23 @@ const onDrag = (event: MouseEvent) => {
if (!isUIAllowed('dataEdit')) return
if (!container.value || !dragRecord.value) return
const { top } = container.value.getBoundingClientRect()
const { top, bottom } = container.value.getBoundingClientRect()
const { scrollHeight } = container.value
if (event.clientY > bottom - 20) {
container.value.scrollTop += 10
} else if (event.clientY < top + 20) {
container.value.scrollTop -= 10
}
console.log(scrollHeight)
const { scrollHeight } = container.value
const percentY = (event.clientY - top - window.scrollY) / scrollHeight
const percentY = (event.clientY - top + container.value.scrollTop) / scrollHeight
const fromCol = dragRecord.value.rowMeta.range?.fk_from_col
const toCol = dragRecord.value.rowMeta.range?.fk_to_col
if (!fromCol) return
console.log('percentY', percentY)
const hour = Math.floor(percentY * 24)
const newStartDate = dayjs(selectedDate.value).add(hour, 'hour')
@ -274,7 +276,7 @@ const stopDrag = (event: MouseEvent) => {
const { scrollHeight } = container.value
const percentY = (event.clientY - top - window.scrollY) / scrollHeight
const percentY = (event.clientY - top + container.value.scrollTop) / scrollHeight
const fromCol = dragRecord.value.rowMeta.range?.fk_from_col
const toCol = dragRecord.value.rowMeta.range?.fk_to_col

Loading…
Cancel
Save