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
1 changed files with 31 additions and 22 deletions
|
@ -354,6 +354,7 @@ function AgendaEventRenderer() {
|
|||
function draggableDayEvent(event, eventElement, isStart) {
|
||||
if (!opt('disableDragging') && eventElement.draggable) {
|
||||
var origWidth;
|
||||
var revert;
|
||||
var allDay=true;
|
||||
var dayDelta;
|
||||
var dis = opt('isRTL') ? -1 : 1;
|
||||
|
@ -370,9 +371,9 @@ function AgendaEventRenderer() {
|
|||
hideEvents(event, eventElement);
|
||||
origWidth = eventElement.width();
|
||||
hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
|
||||
eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta);
|
||||
clearOverlays();
|
||||
if (cell) {
|
||||
revert = false;
|
||||
dayDelta = colDelta * dis;
|
||||
if (!cell.row) {
|
||||
// on full-days
|
||||
|
@ -383,28 +384,43 @@ function AgendaEventRenderer() {
|
|||
resetElement();
|
||||
}else{
|
||||
// mouse is over bottom slots
|
||||
if (isStart && allDay) {
|
||||
// convert event to temporary slot-event
|
||||
eventElement.width(colWidth - 10); // don't use entire width
|
||||
setOuterHeight(
|
||||
eventElement,
|
||||
slotHeight * Math.round(
|
||||
(event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes'))
|
||||
/ opt('slotMinutes')
|
||||
)
|
||||
);
|
||||
eventElement.draggable('option', 'grid', [colWidth, 1]);
|
||||
allDay = false;
|
||||
if (isStart) {
|
||||
if (allDay) {
|
||||
// convert event to temporary slot-event
|
||||
eventElement.width(colWidth - 10); // don't use entire width
|
||||
setOuterHeight(
|
||||
eventElement,
|
||||
slotHeight * Math.round(
|
||||
(event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes'))
|
||||
/ opt('slotMinutes')
|
||||
)
|
||||
);
|
||||
eventElement.draggable('option', 'grid', [colWidth, 1]);
|
||||
allDay = false;
|
||||
}
|
||||
}else{
|
||||
revert = true;
|
||||
}
|
||||
}
|
||||
revert = revert || (allDay && !dayDelta);
|
||||
}else{
|
||||
revert = true;
|
||||
}
|
||||
eventElement.draggable('option', 'revert', revert);
|
||||
}, ev, 'drag');
|
||||
},
|
||||
stop: function(ev, ui) {
|
||||
var cell = hoverListener.stop();
|
||||
hoverListener.stop();
|
||||
clearOverlays();
|
||||
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!
|
||||
eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
|
||||
var minuteDelta = 0;
|
||||
|
@ -415,13 +431,6 @@ function AgendaEventRenderer() {
|
|||
- (event.start.getHours() * 60 + event.start.getMinutes());
|
||||
}
|
||||
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