(js) Fix display of ghosts when dragging events

pull/203/head
Francis Lachapelle 2016-03-09 09:18:21 -05:00
parent be7ee69f0f
commit ef00885941
3 changed files with 8 additions and 6 deletions

3
NEWS
View File

@ -5,7 +5,8 @@ Enhancements
- [web] updated Angular Material to version 1.0.6
Bug fixes
- [web] fix missing columns in SELECT statements (PostgreSQL)
- [web] fixed missing columns in SELECT statements (PostgreSQL)
- [web] fixed display of ghosts when dragging events
3.0.2 (2016-03-04)
------------------

View File

@ -421,6 +421,8 @@
Component.$resetGhost = function() {
this.$ghost.pointerHandler = null;
this.$ghost.component = null;
this.$ghost.startHour = null;
this.$ghost.endHour = null;
};
/**

View File

@ -47,7 +47,7 @@
component = scope.block.component;
dayNumber = scope.block.dayNumber;
blockIndex = _.findIndex(component.blocks, _.matchesProperty('dayNumber', dayNumber));
blockIndex = _.findIndex(component.blocks, ['dayNumber', dayNumber]);
isFirstBlock = (blockIndex === 0);
isLastBlock = (blockIndex === component.blocks.length - 1);
@ -113,7 +113,7 @@
}
function dragStart(ev) {
var block, dragMode, eventType, isHourCell, isMonthly, startDate, newData, newComponent, pointerHandler, calendarData;
var block, eventType, isHourCell, isMonthly, startDate, newData, newComponent, pointerHandler, calendarData;
isHourCell = element.hasClass('clickableHourCell');
isMonthly = (element[0].parentNode.tagName == 'SG-CALENDAR-MONTH-DAY') ||
@ -166,10 +166,9 @@
pointerHandler.initFromCalendar(calendarData);
// Update Component.$ghost
Component.$ghost.starthour = block.starthour;
Component.$ghost.component = block.component;
$log.debug('emit calendar:dragstart ' + eventType + ' ' + dragMode);
$log.debug('emit calendar:dragstart ' + eventType);
$rootScope.$emit('calendar:dragstart');
}
@ -266,7 +265,7 @@
// Get the start (first quarter) from the event's first block
// Compute overall length
this.start = block.component.blocks[0].start;
this.duration = _.sum(block.component.blocks, function(b) {
this.duration = _.sumBy(block.component.blocks, function(b) {
return b.length;
});
}