1
0
Fork 0
forked from 0x2620/oxjs

various annotation-related bugfixes

This commit is contained in:
rlx 2012-01-27 19:59:11 +05:30
commit a7a3f167c9
10 changed files with 135 additions and 75 deletions

View file

@ -42,7 +42,8 @@ Ox.Calendar = function(options, self) {
showTypes: ['date', 'place', 'person', 'other'],
showZoombar: false,
width: 256,
zoom: 8
zoom: 8,
zoomOnlyWhenFocused: false
})
.options(options || {})
.addClass('OxCalendar')
@ -833,6 +834,9 @@ Ox.Calendar = function(options, self) {
}
function getMouseDate(e) {
Ox.print('mousedate', e.clientX, that.offset().left, self.options.width, new Date(+self.options.date + (
e.clientX - that.offset().left - self.options.width / 2 - 1
) * getSecondsPerPixel() * 1000))
return new Date(+self.options.date + (
e.clientX - that.offset().left - self.options.width / 2 - 1
) * getSecondsPerPixel() * 1000);
@ -945,7 +949,11 @@ Ox.Calendar = function(options, self) {
function mousewheel(e, delta, deltaX, deltaY) {
//Ox.Log('Calendar', 'mousewheel', delta, deltaX, deltaY);
var deltaZ = 0;
if (!self.mousewheel && Math.abs(deltaY) > Math.abs(deltaX)) {
if (
(!self.options.zoomOnlyWhenFocused || that.hasFocus())
&& !self.mousewheel
&& Math.abs(deltaY) > Math.abs(deltaX)
) {
if (deltaY < 0 && self.options.zoom > 0) {
deltaZ = -1;
} else if (deltaY > 0 && self.options.zoom < self.maxZoom) {
@ -962,6 +970,7 @@ Ox.Calendar = function(options, self) {
self.mousewheel = false;
}, 250);
}
that.hasFocus() && e.preventDefault();
}
function overlaps(eventA, eventB) {