add dragpause event

This commit is contained in:
rlx 2011-04-20 16:04:21 +00:00
parent cc121a11d9
commit 07be4293a5

View file

@ -907,7 +907,7 @@ requires
function mousedown(e) {
/*
better mouse events
on mousedown:
mousedown:
trigger mousedown
within 250 msec:
mouseup: trigger anyclick ("click" would collide with click events of certain widgets)
@ -918,9 +918,12 @@ requires
trigger mouserepeat every 50 msec
trigger dragstart
mousemove: trigger drag
no mousemove within 250 msec:
trigger dragpause
mouseup: trigger dragend
*/
var mouseInterval = 0;
var dragTimeout = 0,
mouseInterval = 0;
if (!self.mouseTimeout) {
// first mousedown
that.triggerEvent('mousedown', e);
@ -943,6 +946,7 @@ requires
.mousemove(mousemove)
.one('mouseup', function(e) {
clearInterval(mouseInterval);
clearTimeout(dragTimeout);
Ox.UI.$window.unbind('mousemove', mousemove);
that.triggerEvent('dragend', e);
});
@ -959,6 +963,12 @@ requires
}
Ox.UI.$window.one('mouseup', mouseup);
function mousemove(e) {
clearTimeout(dragTimeout);
dragTimeout = setTimeout(function() {
that.triggerEvent({
dragpause: e
});
}, 250);
that.triggerEvent('drag', e);
}
function mouseup(e) {
@ -10969,6 +10979,7 @@ requires
.bindEvent({
dragstart: dragstart,
drag: drag,
dragpause: dragpause,
dragend: dragend
})
.appendTo(that);
@ -11016,6 +11027,7 @@ requires
.bindEvent({
dragstart: dragstartScrollbar,
drag: dragScrollbar,
dragpause: dragpauseScrollbar,
dragend: dragendScrollbar
})
.appendTo(that);
@ -11070,7 +11082,15 @@ requires
});
self.$scrollbar.css({
marginLeft: Math.round((e.clientX - self.drag.x) / 16) + 'px'
});
});
}
}
function dragpause(event, e) {
if (self.drag) {
Ox.print('dragpause')
dragafter();
self.drag = {x: e.clientX};
}
}
@ -11079,6 +11099,7 @@ requires
self.options.date = new Date(
+self.options.date + (self.drag.x - e.clientX) * getSecondsPerPixel() * 1000
);
self.drag = null;
dragafter();
}
}
@ -11096,15 +11117,20 @@ requires
});
}
function dragpauseScrollbar(event, e) {
self.drag = {x: e.clientX};
dragafter();
}
function dragendScrollbar(event, e) {
self.options.date = new Date(
+self.options.date + (self.drag.x - e.clientX) * getSecondsPerPixel() * 1000 * 16
);
self.drag = null;
dragafter();
}
function dragafter() {
self.drag = null;
self.$content.css({
marginLeft: 0
});
@ -11192,18 +11218,15 @@ requires
var fits = true;
Ox.forEach(dates, function(date_) {
if (overlaps(date, date_)) {
Ox.print('over', date.name, date_.name)
fits = false;
return false;
}
});
if (fits) {
Ox.print(date.name, 'fits', line_)
line = line_;
return false;
}
});
Ox.print(date.name, line)
if (line == self.$lines.length) {
self.lineDates[line] = [];
self.$lines[line] = new Ox.Element()