fix(calendar(js)): swap start-end dates when delta is negative

When creating an event by drag'n'dropping from bottom to top, the
original coordinate become the start date.
This commit is contained in:
Francis Lachapelle
2019-10-30 13:55:03 -04:00
parent 060dea3818
commit 8b45f2c731
2 changed files with 11 additions and 1 deletions
@@ -222,16 +222,19 @@
// Adjust component or create new component through drag'n'drop
function updateComponentFromGhost($event) {
var component, pointerHandler, coordinates, delta, params, calendarNumber, activeCalendars;
var component, pointerHandler, originalCoordinates, coordinates, delta, params, calendarNumber, activeCalendars;
component = Component.$ghost.component;
pointerHandler = Component.$ghost.pointerHandler;
if (component.isNew) {
originalCoordinates = pointerHandler.originalEventCoordinates;
coordinates = pointerHandler.currentEventCoordinates;
component.summary = '';
if (component.isAllDay)
coordinates.duration -= 96;
if (coordinates.start < originalCoordinates.start)
coordinates.duration *= -1;
component.setDelta(coordinates.duration * 15);
newComponent(null, 'appointment', component)
.catch()