From 1a097cf1d9ea698b79013c02de360c08531029de Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 17 Sep 2021 18:56:17 +0000 Subject: [PATCH] --- ayanova/src/views/home-schedule.vue | 44 +++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/ayanova/src/views/home-schedule.vue b/ayanova/src/views/home-schedule.vue index f9919279..a80bf147 100644 --- a/ayanova/src/views/home-schedule.vue +++ b/ayanova/src/views/home-schedule.vue @@ -318,6 +318,10 @@ export default { createEvent: null, createStart: null, extendOriginal: null, + dragging: false, + showMoreInfoRequested: false, + dragged: false, + dragTimeout: null, formState: { ready: false, dirty: false, @@ -338,8 +342,15 @@ export default { }, methods: { startDrag({ event, timed }) { - //console.log("startDrag"); + console.log("startDrag"); if (event && timed) { + clearTimeout(this.dragTimeout); + + this.dragged = false; + this.dragTimeout = setTimeout(() => { + this.dragged = true; + }, 100); // Minimal delay to be regarded as drag instead of click + //console.log("if passed true"); this.dragEvent = event; this.dragTime = null; @@ -357,7 +368,9 @@ export default { //console.log("startTime dragTime is", this.dragTime); } else { this.createStart = this.roundTime(mouse); - console.log("startTime::STUB Create new element, popup FAB speeddial here"); + console.log( + "startTime::STUB Create new element, popup FAB speeddial here" + ); // //console.log("startTime, create start:", this.createStart); // this.createEvent = { // name: `Event #${this.events.length}`, @@ -383,7 +396,11 @@ export default { //console.log("mouseMove got time:", mouse); if (this.dragEvent && this.dragTime !== null) { - //console.log("mosueMove:A"); + this.dragging = true; + // console.log("mosueMove:A", { + // dragEvent: this.dragEvent, + // dragTime: this.dragTime + // }); const start = this.dragEvent.start; const end = this.dragEvent.end; const duration = end - start; @@ -407,7 +424,14 @@ export default { } }, endDrag() { - //console.log("endDrag"); + // console.log("endDrag, dragging: ", this.dragging); + if (!this.dragging) { + //it's a click to open an event for more info + console.log("EndDrag - moreinfo event:", this.dragEvent); + } else { + this.dragging = false; + this.showMoreInfoRequested = true; + } this.dragTime = null; this.dragEvent = null; this.createEvent = null; @@ -415,7 +439,7 @@ export default { this.extendOriginal = null; }, cancelDrag() { - //console.log("cancelDrag"); + console.log("cancelDrag"); if (this.createEvent) { if (this.extendOriginal) { this.createEvent.end = this.extendOriginal; @@ -511,6 +535,16 @@ export default { }); }, async showevInfo({ nativeEvent, event }) { + console.log("showevInfo, dragged: ", this.dragged); + //workaround to disambiguate drag click from view more info click + if (this.dragged) { + return; + //e.preventDefault(); + } + + //this.dragged = false; + + //console.log("showevInfo, dragevent is:", this.dragEvent); ////console.log("showevInfo:event ", JSON.stringify(event)); let route = null; this.evInfo = {};