This commit is contained in:
2021-09-17 18:56:17 +00:00
parent b5b860c402
commit 1a097cf1d9

View File

@@ -318,6 +318,10 @@ export default {
createEvent: null, createEvent: null,
createStart: null, createStart: null,
extendOriginal: null, extendOriginal: null,
dragging: false,
showMoreInfoRequested: false,
dragged: false,
dragTimeout: null,
formState: { formState: {
ready: false, ready: false,
dirty: false, dirty: false,
@@ -338,8 +342,15 @@ export default {
}, },
methods: { methods: {
startDrag({ event, timed }) { startDrag({ event, timed }) {
//console.log("startDrag"); console.log("startDrag");
if (event && timed) { 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"); //console.log("if passed true");
this.dragEvent = event; this.dragEvent = event;
this.dragTime = null; this.dragTime = null;
@@ -357,7 +368,9 @@ export default {
//console.log("startTime dragTime is", this.dragTime); //console.log("startTime dragTime is", this.dragTime);
} else { } else {
this.createStart = this.roundTime(mouse); 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); // //console.log("startTime, create start:", this.createStart);
// this.createEvent = { // this.createEvent = {
// name: `Event #${this.events.length}`, // name: `Event #${this.events.length}`,
@@ -383,7 +396,11 @@ export default {
//console.log("mouseMove got time:", mouse); //console.log("mouseMove got time:", mouse);
if (this.dragEvent && this.dragTime !== null) { 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 start = this.dragEvent.start;
const end = this.dragEvent.end; const end = this.dragEvent.end;
const duration = end - start; const duration = end - start;
@@ -407,7 +424,14 @@ export default {
} }
}, },
endDrag() { 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.dragTime = null;
this.dragEvent = null; this.dragEvent = null;
this.createEvent = null; this.createEvent = null;
@@ -415,7 +439,7 @@ export default {
this.extendOriginal = null; this.extendOriginal = null;
}, },
cancelDrag() { cancelDrag() {
//console.log("cancelDrag"); console.log("cancelDrag");
if (this.createEvent) { if (this.createEvent) {
if (this.extendOriginal) { if (this.extendOriginal) {
this.createEvent.end = this.extendOriginal; this.createEvent.end = this.extendOriginal;
@@ -511,6 +535,16 @@ export default {
}); });
}, },
async showevInfo({ nativeEvent, event }) { 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)); ////console.log("showevInfo:event ", JSON.stringify(event));
let route = null; let route = null;
this.evInfo = {}; this.evInfo = {};