fix a bug where the selected element would be too big if it was off the left side of the screen

This commit is contained in:
rolux 2011-05-27 18:39:47 +02:00
parent dcb567143e
commit eccade6aa9

View file

@ -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) : '' ) +