(js) Fix drag'n'drop in month view

pull/207/head
Francis Lachapelle 2016-05-06 15:45:42 -04:00
parent bf5bee87e6
commit 8789db67b3
3 changed files with 16 additions and 8 deletions

View File

@ -5,11 +5,14 @@
/* /*
* sgCalendarMonthDay - Build list of blocks for a specific day in a month * sgCalendarMonthDay - Build list of blocks for a specific day in a month
* @memberof SOGo.Common * @memberof SOGo.SchedulerUI
* @restrict element * @restrict element
* @param {object} sgBlocks - the events blocks definitions for the current view * @param {object} sgBlocks - the events blocks definitions for the current view
* @param {string} sgDay - the day of the events to display * @param {string} sgDay - the day of the events to display
* @ngInject * @param {function} sgClick - the function to call when clicking on a block.
* Two variables are available: event (the event that triggered the mouse click),
* and component (a Component object)
*
* @example: * @example:
<sg-calendar-monh-day <sg-calendar-monh-day

View File

@ -129,11 +129,15 @@
} }
function getMaxColumns() { function getMaxColumns() {
var max = 0; var mdGridList, max = 0;
//if (type == 'multiday') { if (type == 'monthly') {
mdGridList = scrollView.getElementsByTagName('md-grid-list')[0];
max = parseInt(mdGridList.attributes['md-cols'].value) - 1;
}
else {
max = scrollView.getElementsByClassName('day').length - 1; max = scrollView.getElementsByClassName('day').length - 1;
//} }
return max; return max;
} }

View File

@ -566,6 +566,7 @@
if (pxCoordinates) { if (pxCoordinates) {
coordinates = new SOGoCoordinates(); coordinates = new SOGoCoordinates();
var maxX = view.maxX;
var daysTopOffset = 0; var daysTopOffset = 0;
var dayWidth = view.dayWidth; var dayWidth = view.dayWidth;
var daysOffset = view.daysOffset; var daysOffset = view.daysOffset;
@ -577,9 +578,9 @@
coordinates.x = Math.floor((pxCoordinates.x - daysOffset) / dayWidth); coordinates.x = Math.floor((pxCoordinates.x - daysOffset) / dayWidth);
if (coordinates.x < 0) if (coordinates.x < 0)
coordinates.x = 0; coordinates.x = 0;
else if (coordinates.x > 6) else if (coordinates.x > maxX)
coordinates.x = 6; coordinates.x = maxX;
coordinates.x += 7 * daysY; coordinates.x += (maxX + 1) * daysY;
coordinates.y = 0; coordinates.y = 0;
} }
else { else {