Calendar: Fix very small drags did not open add dialog

This commit is contained in:
nathan 2023-06-14 11:20:41 -06:00
parent 37bfeeaa16
commit b8b5601b48

View File

@ -607,15 +607,15 @@ export class et2_calendar_view extends et2_valueWidget
{
end = {};
}
let options = {};
let return_value = true;
if(this.drag_create.start && end.date &&
JSON.stringify(this.drag_create.start.date) !== JSON.stringify(end.date))
{
// Drag from start to end, open dialog
var options = {
start: this.drag_create.start.date < end.date ? this.drag_create.start.date : end.date,
end: this.drag_create.start.date < end.date ? end.date : this.drag_create.start.date
};
options['start'] = this.drag_create.start.date < end.date ? this.drag_create.start.date : end.date;
options['end'] = this.drag_create.start.date < end.date ? end.date : this.drag_create.start.date;
// Whole day needs to go from 00:00 to 23:59
if(end.whole_day || this.drag_create.start.whole_day)
@ -634,6 +634,8 @@ export class et2_calendar_view extends et2_valueWidget
// Add anything else that was set, but not date
jQuery.extend(options, this.drag_create.start, end);
delete (options.date);
return_value = false;
}
// Make sure parent is set, if needed
let app_calendar = this.getInstanceManager().app_obj.calendar || app.calendar;
@ -657,19 +659,8 @@ export class et2_calendar_view extends et2_valueWidget
app.calendar.add(options, this.drag_create.event);
// Wait a bit, having these stops the click
window.setTimeout(jQuery.proxy(function() {
this.drag_create.start = null;
this.drag_create.end = null;
this.drag_create.parent = null;
if(this.drag_create.event)
window.setTimeout(() =>
{
this.drag_create.event = null;
}
},this),100);
return false;
}
this.drag_create.start = null;
this.drag_create.end = null;
this.drag_create.parent = null;
@ -681,10 +672,15 @@ export class et2_calendar_view extends et2_valueWidget
{
this.drag_create.event.destroy();
}
} catch(e) {}
}
catch(e)
{
}
this.drag_create.event = null;
}
return true;
}, 100);
return return_value;
}
/**