more calendar improvements (positioning, scrolling)
This commit is contained in:
parent
474d5f92cb
commit
06f27b75bd
1 changed files with 10 additions and 7 deletions
|
@ -762,7 +762,7 @@ Ox.Calendar = function(options, self) {
|
||||||
|
|
||||||
function panTo(date) {
|
function panTo(date) {
|
||||||
var delta = (date - self.options.date) / 1000 * getPixelsPerSecond(),
|
var delta = (date - self.options.date) / 1000 * getPixelsPerSecond(),
|
||||||
ms = 250 * Math.max(Math.abs(delta) / (self.$content.width() / 2), 1);
|
ms = 250 * Math.min(Math.abs(delta) / (self.$content.width() / 2), 1);
|
||||||
self.$content.animate({
|
self.$content.animate({
|
||||||
marginLeft: -delta + 'px'
|
marginLeft: -delta + 'px'
|
||||||
}, ms, function() {
|
}, ms, function() {
|
||||||
|
@ -801,17 +801,19 @@ Ox.Calendar = function(options, self) {
|
||||||
|
|
||||||
function renderEvents() {
|
function renderEvents() {
|
||||||
var calendarEvent = getCalendarEvent();
|
var calendarEvent = getCalendarEvent();
|
||||||
lineEvents = [],
|
lineEvents = [];
|
||||||
types = ['date']; //['date', 'place', 'person', 'other'];
|
//types = ['date', 'place', 'person', 'other'];
|
||||||
self.options.events.filter(function(event) {
|
self.options.events.filter(function(event) {
|
||||||
// filter out events with types not shown
|
// filter out events with types not shown
|
||||||
// and events outside the visible area
|
// and events outside the visible area
|
||||||
return self.options.showTypes.indexOf(event.type) > -1
|
return self.options.showTypes.indexOf(event.type) > -1
|
||||||
&& overlaps(event, calendarEvent);
|
/*&& overlaps(event, calendarEvent)*/;
|
||||||
}).sort(function(a, b) {
|
}).sort(function(a, b) {
|
||||||
// sort events
|
// sort events
|
||||||
if (a.type != b.type) {
|
if (a.type == 'date' && b.type != 'date') {
|
||||||
return types.indexOf(b.type) - types.indexOf(a.type);
|
return -1;
|
||||||
|
} else if (a.type != 'date' && b.type == 'date') {
|
||||||
|
return 1;
|
||||||
} else if (a.start < b.start || a.start > b.start) {
|
} else if (a.start < b.start || a.start > b.start) {
|
||||||
return a.start - b.start;
|
return a.start - b.start;
|
||||||
} else {
|
} else {
|
||||||
|
@ -852,6 +854,7 @@ Ox.Calendar = function(options, self) {
|
||||||
// sort events by start, ascending
|
// sort events by start, ascending
|
||||||
return a.start - b.start;
|
return a.start - b.start;
|
||||||
}).forEach(function(event) {
|
}).forEach(function(event) {
|
||||||
|
overlaps(event, calendarEvent) &&
|
||||||
getEventElement(event).appendTo($line);
|
getEventElement(event).appendTo($line);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue