pass native js event to select/unselect callbacks, final touches for 1.4.7
This commit is contained in:
parent
1729499290
commit
91e436dc0a
|
@ -1,4 +1,18 @@
|
|||
|
||||
version 1.4.7 (7/5/10)
|
||||
- "dropping" external objects onto the calendar
|
||||
- droppable (boolean, to turn on/off)
|
||||
- dropAccept (to filter which events the calendar will accept)
|
||||
- drop (trigger)
|
||||
- selectable options can now be specified with a View Option Hash
|
||||
- bugfixes
|
||||
- dragged & reverted events having wrong time text (issue 406)
|
||||
- bug rendering events that have an endtime with seconds, but no hours/minutes (issue 477)
|
||||
- gotoDate date overflow bug (issue 429)
|
||||
- wrong date reported when clicking on edge of last column in agenda views (412)
|
||||
- support newlines in event titles
|
||||
- select/unselect callbacks now passes native js event
|
||||
|
||||
version 1.4.6 (5/31/10)
|
||||
- "selecting" days or timeslots
|
||||
- options: selectable, selectHelper, unselectAuto, unselectCancel
|
||||
|
|
|
@ -971,7 +971,7 @@ function Agenda(element, options, methods, viewName) {
|
|||
|
||||
function slotSelectionMousedown(ev) {
|
||||
if (view.option('selectable')) {
|
||||
unselect();
|
||||
unselect(ev);
|
||||
var _mousedownElement = this;
|
||||
var dates;
|
||||
hoverListener.start(function(cell, origCell) {
|
||||
|
@ -995,8 +995,9 @@ function Agenda(element, options, methods, viewName) {
|
|||
if (dates) {
|
||||
if (+dates[0] == +dates[1]) {
|
||||
view.trigger('dayClick', _mousedownElement, dates[0], false, ev);
|
||||
// BUG: _mousedownElement will sometimes be the overlay
|
||||
}
|
||||
reportSelection(dates[0], dates[3], false);
|
||||
reportSelection(dates[0], dates[3], false, ev);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1021,16 +1022,16 @@ function Agenda(element, options, methods, viewName) {
|
|||
reportSelection(startDate, endDate, allDay);
|
||||
};
|
||||
|
||||
function reportSelection(startDate, endDate, allDay) {
|
||||
function reportSelection(startDate, endDate, allDay, ev) {
|
||||
selected = true;
|
||||
view.trigger('select', view, startDate, endDate, allDay);
|
||||
view.trigger('select', view, startDate, endDate, allDay, ev);
|
||||
}
|
||||
|
||||
function unselect() {
|
||||
function unselect(ev) {
|
||||
if (selected) {
|
||||
clearSelection();
|
||||
selected = false;
|
||||
view.trigger('unselect', view);
|
||||
view.trigger('unselect', view, ev);
|
||||
}
|
||||
}
|
||||
view.unselect = unselect;
|
||||
|
|
|
@ -542,16 +542,16 @@ function Grid(element, options, methods, viewName) {
|
|||
reportSelection(startDate, endDate, allDay);
|
||||
};
|
||||
|
||||
function reportSelection(startDate, endDate, allDay) {
|
||||
function reportSelection(startDate, endDate, allDay, ev) {
|
||||
selected = true;
|
||||
view.trigger('select', view, startDate, endDate, allDay);
|
||||
view.trigger('select', view, startDate, endDate, allDay, ev);
|
||||
}
|
||||
|
||||
function unselect() {
|
||||
function unselect(ev) {
|
||||
if (selected) {
|
||||
clearOverlay();
|
||||
selected = false;
|
||||
view.trigger('unselect', view);
|
||||
view.trigger('unselect', view, ev);
|
||||
}
|
||||
}
|
||||
view.unselect = unselect;
|
||||
|
|
|
@ -71,7 +71,9 @@ var defaults = {
|
|||
},
|
||||
|
||||
//selectable: false,
|
||||
unselectAuto: true
|
||||
unselectAuto: true,
|
||||
|
||||
dropAccept: '*'
|
||||
|
||||
};
|
||||
|
||||
|
@ -834,7 +836,7 @@ $.fn.fullCalendar = function(options) {
|
|||
var e = $(_e);
|
||||
if (!e.parents('.fc').length) { // not already inside a calendar
|
||||
var accept = options.dropAccept;
|
||||
if (!accept || ($.isFunction(accept) ? accept.call(_e, e) : e.is(accept))) {
|
||||
if ($.isFunction(accept) ? accept.call(_e, e) : e.is(accept)) {
|
||||
_dragElement = _e;
|
||||
view.dragStart(_dragElement, ev, ui);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
function selection_dayMousedown(view, hoverListener, cellDate, cellIsAllDay, renderSelection, clearSelection, reportSelection, unselect) {
|
||||
return function(ev) {
|
||||
if (view.option('selectable')) {
|
||||
unselect();
|
||||
unselect(ev);
|
||||
var _mousedownElement = this;
|
||||
var dates;
|
||||
hoverListener.start(function(cell, origCell) {
|
||||
|
@ -20,8 +20,9 @@ function selection_dayMousedown(view, hoverListener, cellDate, cellIsAllDay, ren
|
|||
if (dates) {
|
||||
if (+dates[0] == +dates[1]) {
|
||||
view.trigger('dayClick', _mousedownElement, dates[0], true, ev);
|
||||
// BUG: _mousedownElement will sometimes be the overlay
|
||||
}
|
||||
reportSelection(dates[0], dates[1], true);
|
||||
reportSelection(dates[0], dates[1], true, ev);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -38,7 +39,7 @@ function selection_unselectAuto(view, unselect) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
unselect();
|
||||
unselect(ev);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,13 +13,18 @@
|
|||
var y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
|
||||
editable: true,
|
||||
droppable: true,
|
||||
drop: function(date, allDay) {
|
||||
console.log('drop', date, allDay);
|
||||
drop: function(date, allDay, ev) {
|
||||
console.log('drop', date, allDay, ev);
|
||||
},
|
||||
//defaultView: 'agendaWeek',
|
||||
|
||||
//firstDay: 1,
|
||||
//isRTL: true,
|
||||
//minTime: '6:30am',
|
||||
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
|
|
|
@ -80,9 +80,11 @@ if (_build) {
|
|||
includeJS('../src/gcal.js');
|
||||
}
|
||||
|
||||
if (!window.DISABLE_FIREBUG_LITE) {
|
||||
//if (!window.DISABLE_FIREBUG_LITE) {
|
||||
if (!window.console || !console.log) {
|
||||
includeJS('firebug-lite/firebug-lite-compressed.js');
|
||||
}
|
||||
//}
|
||||
|
||||
window.onload = function() {
|
||||
$('body').append(
|
||||
|
|
|
@ -21,10 +21,13 @@
|
|||
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
|
||||
},
|
||||
//defaultView: 'agendaWeek',
|
||||
|
||||
//firstDay: 1,
|
||||
//isRTL: true,
|
||||
//minTime: 7,
|
||||
//weekends: false,
|
||||
//allDaySlot: false,
|
||||
|
||||
selectable: true,
|
||||
/*
|
||||
selectable: {
|
||||
|
@ -32,24 +35,33 @@
|
|||
agenda: true
|
||||
},
|
||||
*/
|
||||
//selectHelper: true,
|
||||
|
||||
selectHelper: true,
|
||||
/*
|
||||
selectHelper: function(start, end) {
|
||||
return $("<div style='background:red' />").text(start+' '+end);
|
||||
},
|
||||
*/
|
||||
|
||||
//unselectAuto: false,
|
||||
//unselectCancel: '.fc',
|
||||
select: function(start, end, allDay) {
|
||||
|
||||
select: function(start, end, allDay, ev) {
|
||||
console.log(
|
||||
'---- selection ----\n' +
|
||||
'start: ' + start + '\n' +
|
||||
'end: ' + end + '\n' +
|
||||
'allDay: ' + allDay
|
||||
);
|
||||
if (ev) {
|
||||
//console.log('select mouse: ' + ev.pageX + ', ' + ev.pageY);
|
||||
}
|
||||
},
|
||||
unselect: function() {
|
||||
unselect: function(ev) {
|
||||
console.log('unselect');
|
||||
if (ev) {
|
||||
//console.log('unselect mouse: ' + ev.pageX + ', ' + ev.pageY);
|
||||
}
|
||||
},
|
||||
dayClick: function(date, allDay) {
|
||||
console.log('DAYCLICK', date, allDay);
|
||||
|
|
Loading…
Reference in a new issue