mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-09-09 11:22:41 +08:00
implement granularity for events dragged from all-day-slot into time-slot
This commit is contained in:
@@ -35,7 +35,6 @@ function AgendaEventRenderer() {
|
||||
var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding architecture
|
||||
var getColCnt = t.getColCnt;
|
||||
var getColWidth = t.getColWidth;
|
||||
var getSlotHeight = t.getSlotHeight;
|
||||
var getGranularityHeight = t.getGranularityHeight;
|
||||
var getGranularityMinutes = t.getGranularityMinutes;
|
||||
var getBodyContent = t.getBodyContent;
|
||||
@@ -366,7 +365,8 @@ function AgendaEventRenderer() {
|
||||
var dis = opt('isRTL') ? -1 : 1;
|
||||
var hoverListener = getHoverListener();
|
||||
var colWidth = getColWidth();
|
||||
var slotHeight = getSlotHeight();
|
||||
var granularityHeight = getGranularityHeight();
|
||||
var granularityMinutes = getGranularityMinutes();
|
||||
var minMinute = getMinMinute();
|
||||
eventElement.draggable({
|
||||
zIndex: 9,
|
||||
@@ -397,9 +397,9 @@ function AgendaEventRenderer() {
|
||||
eventElement.width(colWidth - 10); // don't use entire width
|
||||
setOuterHeight(
|
||||
eventElement,
|
||||
slotHeight * Math.round(
|
||||
granularityHeight * Math.round(
|
||||
(event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes')) /
|
||||
opt('slotMinutes')
|
||||
granularityMinutes
|
||||
)
|
||||
);
|
||||
eventElement.draggable('option', 'grid', [colWidth, 1]);
|
||||
@@ -431,8 +431,8 @@ function AgendaEventRenderer() {
|
||||
// changed!
|
||||
var minuteDelta = 0;
|
||||
if (!allDay) {
|
||||
minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) / slotHeight)
|
||||
* opt('slotMinutes')
|
||||
minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) / granularityHeight)
|
||||
* granularityMinutes
|
||||
+ minMinute
|
||||
- (event.start.getHours() * 60 + event.start.getMinutes());
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ function AgendaView(element, calendar, viewName) {
|
||||
t.getRowCnt = function() { return 1 };
|
||||
t.getColCnt = function() { return colCnt };
|
||||
t.getColWidth = function() { return colWidth };
|
||||
t.getSlotHeight = function() { return slotHeight };
|
||||
t.getGranularityHeight = function() { return granularityHeight };
|
||||
t.getGranularityMinutes = function() { return granularityMinutes };
|
||||
t.defaultSelectionEnd = defaultSelectionEnd;
|
||||
|
||||
Reference in New Issue
Block a user