This commit is contained in:
2021-10-04 23:19:10 +00:00
parent 2c909146ea
commit 23167cf6dc
2 changed files with 223 additions and 314 deletions

View File

@@ -138,7 +138,7 @@
<template>
<v-row justify="center">
<v-dialog max-width="600px" v-model="moreInfoDialog">
<v-card color="grey lighten-4" min-width="350px" flat>
<v-card>
<v-toolbar>
<v-btn icon @click="openScheduledItem()">
<v-icon color="primary">{{ iconForSelectedEvent() }}</v-icon>
@@ -411,7 +411,6 @@
</template>
<script>
const FORM_KEY = "home-schedule";
const CLICK_DETECT_TIMEOUT = 100; //100 is a bit too fast to recognize a click
export default {
async created() {
const vm = this;
@@ -526,12 +525,6 @@ export default {
extendBottom(event) {
//console.log("extend bottom fired");
if (event.editable) {
//My work around to disambiguate extending and clicking
// clearTimeout(this.dragTimeout);
// this.dragged = false;
// this.dragTimeout = setTimeout(() => {
// this.dragged = true;
// }, CLICK_DETECT_TIMEOUT); // Min delay to be regarded as extend instead of click, also affects click time to display more info, too short needs faster click
//capture time to see if it's a click or a drag/extend
this.lastMouseDownMS = new Date().getTime();
this.extendEvent = event;
@@ -540,12 +533,6 @@ export default {
}
},
async endDragExtend() {
// console.log("EndDragExtend", {
// extendEvent: this.extendEvent,
// dragged: this.dragged,
// dragEvent: this.dragEvent,
// lastMS: this.lastMouseDownMS
// });
//On drag then dragged is set to true and dragEvent and dragTime are set
//on extend then dragged is set to true extendEvent (actual event), extendOriginal and createStart are set, dragEvent is null
//on create then dragged is set to false and createStart is only value set, dragEvent is null and extendEvent is null
@@ -555,12 +542,7 @@ export default {
//NEW, prompt for deets and create or if cancelled then just remove this faux event from events list (it will be the last one in the array)
this.newItemDialog = true;
} else {
// if (!this.dragged) {
// //we're here due to mouse up but it's not a drag or an extend so it's a More Info mouse up click so bail out now
// this.dragEvent = null; //this needs to be set or it will keep dragging off an editable event even as the moreinfo dialog show
// return;
// }
//MORE INFO
if (this.lastMouseDownMS != null && this.itWasAClickNotADrag()) {
await this.showMoreInfo(this.dragEvent);
this.dragEvent = null; //this needs to be set or it will keep dragging off an editable event even as the moreinfo dialog show
@@ -632,34 +614,22 @@ export default {
},
startDrag({ event }) {
//# mouse down on an event triggers this call
//console.log("StartDrag, event:", JSON.stringify(event));
if (event) {
this.lastMouseDownMS = new Date().getTime(); //snapshot time to disambiguate drag vs click
if (event.editable) {
//My work around to disambiguate dragging and clicking
//clearTimeout(this.dragTimeout);
// console.log("startDrag in editable set dragged false");
this.dragged = false;
// this.dragTimeout = setTimeout(() => {
// this.dragged = true;
// console.log("startDrag event timer fired, dragged set to true");
// }, CLICK_DETECT_TIMEOUT); // Min delay to be regarded as extend instead of click, also affects click time to display more info, too short needs faster click
this.dragEvent = event;
this.dragTime = null;
this.extendOriginal = null;
} else {
this.dragged = false;
this.dragEvent = event;
// this.extendEvent = null;
this.dragTime = null;
}
}
},
itWasAClickNotADrag() {
if (this.lastMouseDownMS == null) {
//console.trace("lastMouseDownMS is null!!");
// return true;
if (this.$ay.dev) {
throw new Error("lastMouseDownMS is null!");
} else {
@@ -672,7 +642,6 @@ export default {
}
const elapsed = new Date().getTime() - this.lastMouseDownMS;
this.lastMouseDownMS = null;
// console.log("itWasAClickNotADrag elapsed:", elapsed);
return elapsed < 200;
},
mouseMoveDayView(tms) {
@@ -727,7 +696,6 @@ export default {
if (this.dragEvent.editable) {
const start = this.dragEvent.start;
this.dragTime = mouse - start;
} else {
}
} else {
//# DAY VIEW CREATE START EVENT
@@ -762,21 +730,6 @@ export default {
tms.minute
).getTime();
},
diagInfo() {
if (this.$refs.calendar) {
return (
"cal" +
JSON.stringify({
start: this.$refs.calendar.start,
end: this.$refs.calendar.end,
focus: this.focus,
firstInterval: this.$refs.calendar.firstInterval
})
);
} else {
return "no calendar";
}
},
typeToLabel() {
switch (this.viewType) {
case "month":
@@ -822,12 +775,6 @@ export default {
});
},
async showMoreInfo(event) {
//console.log("showMoreInfo, event is", event);
//workaround to disambiguate drag click from view more info click
// if (this.dragged) {
// return;
// }
// console.log("showMoreINfo not dragged, popping up");
this.selectedEvent = event;
let route = null;
this.evInfo = {};
@@ -852,21 +799,6 @@ export default {
window.$gz.form.setErrorBoxErrors(this);
}
}
// const open = () => {
// this.selectedEvent = event;
// this.selectedElement = nativeEvent.target;
// requestAnimationFrame(() =>
// requestAnimationFrame(() => (this.moreInfoDialog = true))
// );
// };
// if (this.moreInfoDialog) {
// this.moreInfoDialog = false;
// requestAnimationFrame(() => requestAnimationFrame(() => open()));
// } else {
// open();
// }
// console.log("show more info stopping propagation");
// nativeEvent.stopPropagation();
},
async fetchEvents({ start, end }) {
try {