refactor and simplify the way view switching/rerendering works

This commit is contained in:
Adam Shaw
2013-08-06 23:23:03 -07:00
parent 6da36c7bdf
commit d2aa9e9f4c
8 changed files with 184 additions and 217 deletions
+9 -10
View File
@@ -12,10 +12,10 @@ function View(element, calendar, viewName) {
t.trigger = trigger;
t.isEventDraggable = isEventDraggable;
t.isEventResizable = isEventResizable;
t.reportEvents = reportEvents;
t.setEventData = setEventData;
t.clearEventData = clearEventData;
t.eventEnd = eventEnd;
t.reportEventElement = reportEventElement;
t.reportEventClear = reportEventClear;
t.eventElementHandlers = eventElementHandlers;
t.showEvents = showEvents;
t.hideEvents = hideEvents;
@@ -95,8 +95,7 @@ function View(element, calendar, viewName) {
------------------------------------------------------------------------------*/
// report when view receives new events
function reportEvents(events) { // events are already normalized at this point
function setEventData(events) { // events are already normalized at this point
eventsByID = {};
var i, len=events.length, event;
for (i=0; i<len; i++) {
@@ -108,6 +107,12 @@ function View(element, calendar, viewName) {
}
}
}
function clearEventData() {
eventElements = [];
eventElementsByID = {};
}
// returns a Date object for an event's end
@@ -132,12 +137,6 @@ function View(element, calendar, viewName) {
}
function reportEventClear() {
eventElements = [];
eventElementsByID = {};
}
// attaches eventClick, eventMouseover, eventMouseout
function eventElementHandlers(event, eventElement) {
eventElement