calendar update

This commit is contained in:
rlx 2011-10-03 14:12:31 +00:00
parent ea76fed699
commit 0b53fc0566

View file

@ -635,12 +635,11 @@ Ox.Calendar = function(options, self) {
} }
function getOverlayWidths() { function getOverlayWidths() {
var width = that.width() || self.options.width, var width = Math.round(self.options.width / getScrollbarFactor());
centerWidth = Math.round(width / getScrollbarFactor());
return [ return [
Math.floor((width - centerWidth) / 2), Math.floor((self.options.width - width) / 2),
centerWidth, width,
Math.ceil((width - centerWidth) / 2), Math.ceil((self.options.width - width) / 2),
]; ];
} }
@ -776,7 +775,6 @@ Ox.Calendar = function(options, self) {
} }
function panTo(date, line) { function panTo(date, line) {
Ox.print('panning???')
var delta = Math.round((date - self.options.date) / 1000 * getPixelsPerSecond()), var delta = Math.round((date - self.options.date) / 1000 * getPixelsPerSecond()),
// 250 ms for half the width of the visible area // 250 ms for half the width of the visible area
ms = 250 * Math.min(Math.abs(delta) / (self.$content.width() / 2), 1); ms = 250 * Math.min(Math.abs(delta) / (self.$content.width() / 2), 1);
@ -976,7 +974,7 @@ Ox.Calendar = function(options, self) {
self.options.selected = id; self.options.selected = id;
($element || getEventElementById(id)).addClass('OxSelected'); ($element || getEventElementById(id)).addClass('OxSelected');
// fixme: map event should also be 'select', not 'selectplace' // fixme: map event should also be 'select', not 'selectplace'
that.triggerEvent('select', {id: id}); that.triggerEvent('select', Ox.getObjectById(self.options.events, id));
} else { } else {
if (self.options.selected !== '') { if (self.options.selected !== '') {
self.options.selected = ''; self.options.selected = '';
@ -996,7 +994,7 @@ Ox.Calendar = function(options, self) {
} }
} else { } else {
selectEvent(''); selectEvent('');
panTo(getMouseDate(e)); panTo(getMouseDate(data));
} }
} }
@ -1045,12 +1043,21 @@ Ox.Calendar = function(options, self) {
} }
}; };
that.panToEvent = function() {
panToSelected();
};
that.resizeCalendar = function() { that.resizeCalendar = function() {
self.$zoomInput.options({size: that.width()}); self.options.width = that.width();
self.$zoomInput.options({size: self.options.width});
getLines(); getLines();
renderCalendar(); renderCalendar();
}; };
that.zoomToEvent = function() {
zoomToSelected();
};
return that; return that;
}; };