From 0b53fc0566ca73062e000b63d41620ccf2509139 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Mon, 3 Oct 2011 14:12:31 +0000 Subject: [PATCH] calendar update --- source/Ox.UI/js/Calendar/Ox.Calendar.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/source/Ox.UI/js/Calendar/Ox.Calendar.js b/source/Ox.UI/js/Calendar/Ox.Calendar.js index f62cc24a..e380da06 100644 --- a/source/Ox.UI/js/Calendar/Ox.Calendar.js +++ b/source/Ox.UI/js/Calendar/Ox.Calendar.js @@ -635,12 +635,11 @@ Ox.Calendar = function(options, self) { } function getOverlayWidths() { - var width = that.width() || self.options.width, - centerWidth = Math.round(width / getScrollbarFactor()); + var width = Math.round(self.options.width / getScrollbarFactor()); return [ - Math.floor((width - centerWidth) / 2), - centerWidth, - Math.ceil((width - centerWidth) / 2), + Math.floor((self.options.width - width) / 2), + width, + Math.ceil((self.options.width - width) / 2), ]; } @@ -776,7 +775,6 @@ Ox.Calendar = function(options, self) { } function panTo(date, line) { - Ox.print('panning???') var delta = Math.round((date - self.options.date) / 1000 * getPixelsPerSecond()), // 250 ms for half the width of the visible area 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; ($element || getEventElementById(id)).addClass('OxSelected'); // fixme: map event should also be 'select', not 'selectplace' - that.triggerEvent('select', {id: id}); + that.triggerEvent('select', Ox.getObjectById(self.options.events, id)); } else { if (self.options.selected !== '') { self.options.selected = ''; @@ -996,7 +994,7 @@ Ox.Calendar = function(options, self) { } } else { selectEvent(''); - panTo(getMouseDate(e)); + panTo(getMouseDate(data)); } } @@ -1045,12 +1043,21 @@ Ox.Calendar = function(options, self) { } }; + that.panToEvent = function() { + panToSelected(); + }; + that.resizeCalendar = function() { - self.$zoomInput.options({size: that.width()}); + self.options.width = that.width(); + self.$zoomInput.options({size: self.options.width}); getLines(); renderCalendar(); }; + that.zoomToEvent = function() { + zoomToSelected(); + }; + return that; };