fixed bug when dragging non-start event segment from all-day slot to timed-slot in agenda view
This commit is contained in:
parent
075df1d144
commit
6823f382e0
|
@ -354,6 +354,7 @@ function AgendaEventRenderer() {
|
||||||
function draggableDayEvent(event, eventElement, isStart) {
|
function draggableDayEvent(event, eventElement, isStart) {
|
||||||
if (!opt('disableDragging') && eventElement.draggable) {
|
if (!opt('disableDragging') && eventElement.draggable) {
|
||||||
var origWidth;
|
var origWidth;
|
||||||
|
var revert;
|
||||||
var allDay=true;
|
var allDay=true;
|
||||||
var dayDelta;
|
var dayDelta;
|
||||||
var dis = opt('isRTL') ? -1 : 1;
|
var dis = opt('isRTL') ? -1 : 1;
|
||||||
|
@ -370,9 +371,9 @@ function AgendaEventRenderer() {
|
||||||
hideEvents(event, eventElement);
|
hideEvents(event, eventElement);
|
||||||
origWidth = eventElement.width();
|
origWidth = eventElement.width();
|
||||||
hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
|
hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
|
||||||
eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta);
|
|
||||||
clearOverlays();
|
clearOverlays();
|
||||||
if (cell) {
|
if (cell) {
|
||||||
|
revert = false;
|
||||||
dayDelta = colDelta * dis;
|
dayDelta = colDelta * dis;
|
||||||
if (!cell.row) {
|
if (!cell.row) {
|
||||||
// on full-days
|
// on full-days
|
||||||
|
@ -383,7 +384,8 @@ function AgendaEventRenderer() {
|
||||||
resetElement();
|
resetElement();
|
||||||
}else{
|
}else{
|
||||||
// mouse is over bottom slots
|
// mouse is over bottom slots
|
||||||
if (isStart && allDay) {
|
if (isStart) {
|
||||||
|
if (allDay) {
|
||||||
// convert event to temporary slot-event
|
// convert event to temporary slot-event
|
||||||
eventElement.width(colWidth - 10); // don't use entire width
|
eventElement.width(colWidth - 10); // don't use entire width
|
||||||
setOuterHeight(
|
setOuterHeight(
|
||||||
|
@ -396,15 +398,29 @@ function AgendaEventRenderer() {
|
||||||
eventElement.draggable('option', 'grid', [colWidth, 1]);
|
eventElement.draggable('option', 'grid', [colWidth, 1]);
|
||||||
allDay = false;
|
allDay = false;
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
revert = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
revert = revert || (allDay && !dayDelta);
|
||||||
|
}else{
|
||||||
|
revert = true;
|
||||||
|
}
|
||||||
|
eventElement.draggable('option', 'revert', revert);
|
||||||
}, ev, 'drag');
|
}, ev, 'drag');
|
||||||
},
|
},
|
||||||
stop: function(ev, ui) {
|
stop: function(ev, ui) {
|
||||||
var cell = hoverListener.stop();
|
hoverListener.stop();
|
||||||
clearOverlays();
|
clearOverlays();
|
||||||
trigger('eventDragStop', eventElement, event, ev, ui);
|
trigger('eventDragStop', eventElement, event, ev, ui);
|
||||||
if (cell && (!allDay || dayDelta)) {
|
if (revert) {
|
||||||
|
// hasn't moved or is out of bounds (draggable has already reverted)
|
||||||
|
resetElement();
|
||||||
|
if ($.browser.msie) {
|
||||||
|
eventElement.css('filter', ''); // clear IE opacity side-effects
|
||||||
|
}
|
||||||
|
showEvents(event, eventElement);
|
||||||
|
}else{
|
||||||
// changed!
|
// changed!
|
||||||
eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
|
eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
|
||||||
var minuteDelta = 0;
|
var minuteDelta = 0;
|
||||||
|
@ -415,13 +431,6 @@ function AgendaEventRenderer() {
|
||||||
- (event.start.getHours() * 60 + event.start.getMinutes());
|
- (event.start.getHours() * 60 + event.start.getMinutes());
|
||||||
}
|
}
|
||||||
eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui);
|
eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui);
|
||||||
}else{
|
|
||||||
// hasn't moved or is out of bounds (draggable has already reverted)
|
|
||||||
resetElement();
|
|
||||||
if ($.browser.msie) {
|
|
||||||
eventElement.css('filter', ''); // clear IE opacity side-effects
|
|
||||||
}
|
|
||||||
showEvents(event, eventElement);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue