more calendar improvements (high zoom levels)

This commit is contained in:
rolux 2011-05-25 19:47:34 +02:00
parent dc23259308
commit d98c34407d
2 changed files with 7 additions and 21 deletions

View file

@ -202,6 +202,6 @@ Ox.load('UI', {debug: true, hideScreen: true, showScreen: true, theme: 'modern'}
height: window.innerHeight,
width: window.innerWidth,
zoom: 4
}).appendTo(Ox.UI.$body);
}).appendTo(Ox.UI.$body).gainFocus();
});

View file

@ -583,10 +583,10 @@ Ox.Calendar = function(options, self) {
}
function getEventElement(event, zoom) {
var left = getPosition(event.start, zoom),
var left = Math.max(getPosition(event.start, zoom), -10000),
paddingLeft = (event.type && left < 0 ? -left : 0),
width = Math.max(getPosition(event.end, zoom) - left, 1) - paddingLeft;
//textLeft = (left < 0 ? -left : 0);
width = Ox.limit(getPosition(event.end, zoom) - left, 1, 20000) - paddingLeft;
//Ox.print('LEFT', left, 'WIDTH', width)
return new Ox.Element()
.addClass('OxEvent' +
(event.type ? ' Ox' + Ox.toTitleCase(event.type) : '' ) +
@ -601,20 +601,6 @@ Ox.Calendar = function(options, self) {
id: event.id
})
.html('&nbsp;' + event.name + '&nbsp;')
/*
.append(
$('<div>')
.addClass('OxEventText')
.css({
position: 'absolute',
width: (width - 4) + 'px',
height: '12px',
padding: '2px',
paddingLeft: textLeft + 'px',
})
.html('&nbsp;' + event.name)
);
*/
}
function getEventElementById(id) {
@ -914,8 +900,8 @@ Ox.Calendar = function(options, self) {
}
function zoomTo(zoom) {
self.options.zoom = zoom;
self.$zoomInput.options({value: zoom});
self.options.zoom = Ox.limit(zoom, 0, self.maxZoom);
self.$zoomInput.options({value: self.options.zoom});
renderCalendar();
}
@ -933,7 +919,7 @@ Ox.Calendar = function(options, self) {
}
function getZoom() {
var zoom;
Ox.loop(32, 0, function(z) {
Ox.loop(self.maxZoom, 0, function(z) {
var calendarDuration = getEventDuration(getCalendarEvent(z));
if (calendarDuration > eventDuration) {
zoom = z;