From eccade6aa98cae3299979a72c1650d23fd2a2e2f Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 27 May 2011 18:39:47 +0200 Subject: [PATCH] fix a bug where the selected element would be too big if it was off the left side of the screen --- source/Ox.UI/js/Calendar/Ox.Calendar.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/Ox.UI/js/Calendar/Ox.Calendar.js b/source/Ox.UI/js/Calendar/Ox.Calendar.js index 669cf5d2..f5f6ab7d 100644 --- a/source/Ox.UI/js/Calendar/Ox.Calendar.js +++ b/source/Ox.UI/js/Calendar/Ox.Calendar.js @@ -590,6 +590,14 @@ Ox.Calendar = function(options, self) { var left = Math.max(getPosition(event.startTime, zoom), -10000), paddingLeft = (event.type && left < 0 ? -left : 0), width = Ox.limit(getPosition(event.endTime, zoom) - left, 1, 20000) - paddingLeft; + // selected element may be past the left edge of the screen + if (width < 0) { + paddingLeft = 0; + width = getPosition(event.endTime, zoom) - left; + } + if (event.name == 'Martin Luther') { + Ox.print('left', left, 'pL', paddingLeft, 'width', width) + } return new Ox.Element() .addClass('OxEvent' + (event.type ? ' Ox' + Ox.toTitleCase(event.type) : '' ) +