Major new version #2
@ -47,6 +47,11 @@ const selection = ref({ startDate: null, dayCount: 0 })
|
|||||||
const isDragging = ref(false)
|
const isDragging = ref(false)
|
||||||
const dragAnchor = ref(null)
|
const dragAnchor = ref(null)
|
||||||
|
|
||||||
|
// Double-tap state
|
||||||
|
const lastTapTime = ref(0)
|
||||||
|
const lastTapDate = ref(null)
|
||||||
|
const DOUBLE_TAP_DELAY = 300 // milliseconds
|
||||||
|
|
||||||
const WEEK_MS = 7 * 24 * 60 * 60 * 1000
|
const WEEK_MS = 7 * 24 * 60 * 60 * 1000
|
||||||
|
|
||||||
const minVirtualWeek = computed(() => {
|
const minVirtualWeek = computed(() => {
|
||||||
@ -305,6 +310,16 @@ function clearSelection() {
|
|||||||
selection.value = { startDate: null, dayCount: 0 }
|
selection.value = { startDate: null, dayCount: 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDoubleTap(dateStr) {
|
||||||
|
const now = Date.now()
|
||||||
|
const isDouble = lastTapDate.value === dateStr && now - lastTapTime.value <= DOUBLE_TAP_DELAY
|
||||||
|
|
||||||
|
lastTapTime.value = now
|
||||||
|
lastTapDate.value = dateStr
|
||||||
|
|
||||||
|
return isDouble
|
||||||
|
}
|
||||||
|
|
||||||
function startDrag(dateStr) {
|
function startDrag(dateStr) {
|
||||||
if (calendarStore.config.select_days === 0) return
|
if (calendarStore.config.select_days === 0) return
|
||||||
isDragging.value = true
|
isDragging.value = true
|
||||||
@ -383,7 +398,10 @@ onBeforeUnmount(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const handleDayMouseDown = (dateStr) => {
|
const handleDayMouseDown = (dateStr) => {
|
||||||
startDrag(dateStr)
|
// Check for double tap - only start drag on second tap
|
||||||
|
if (isDoubleTap(dateStr)) {
|
||||||
|
startDrag(dateStr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDayMouseEnter = (dateStr) => {
|
const handleDayMouseEnter = (dateStr) => {
|
||||||
@ -404,7 +422,10 @@ const handleDayMouseUp = (dateStr) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleDayTouchStart = (dateStr) => {
|
const handleDayTouchStart = (dateStr) => {
|
||||||
startDrag(dateStr)
|
// Check for double tap - only start drag on second tap
|
||||||
|
if (isDoubleTap(dateStr)) {
|
||||||
|
startDrag(dateStr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDayTouchMove = (dateStr) => {
|
const handleDayTouchMove = (dateStr) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user