mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-07 14:28:52 +00:00
(js) Scroll to user's defined day start hour
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
</div>
|
||||
</md-toolbar>
|
||||
|
||||
<md-content class="md-flex" sg-calendar-scroll-view="monthview">
|
||||
<md-content class="md-flex" sg-calendar-scroll-view="monthly">
|
||||
<div class="calendarView monthView">
|
||||
<md-grid-list
|
||||
md-cols="7"
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
if (Calendar.$view && Calendar.$view.type == scrollViewCtrl.type) {
|
||||
// The view of the dragging block is the scrolling view of this ghost block
|
||||
|
||||
isRelative = scrollViewCtrl.type === 'multiday-allday' || scrollViewCtrl.type === 'monthly';
|
||||
isRelative = scrollViewCtrl.type === 'multiday-allday';
|
||||
originalDay = scope.block.pointerHandler.originalEventCoordinates.dayNumber;
|
||||
currentDay = scope.block.pointerHandler.currentEventCoordinates.dayNumber;
|
||||
start = scope.block.pointerHandler.currentEventCoordinates.start;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
..
|
||||
</md-content>
|
||||
*/
|
||||
sgCalendarScrollView.$inject = ['$rootScope', '$window', '$document', '$q', '$timeout', '$mdGesture', 'Calendar', 'Component'];
|
||||
function sgCalendarScrollView($rootScope, $window, $document, $q, $timeout, $mdGesture, Calendar, Component) {
|
||||
sgCalendarScrollView.$inject = ['$rootScope', '$window', '$document', '$q', '$timeout', '$mdGesture', 'Calendar', 'Component', 'Preferences'];
|
||||
function sgCalendarScrollView($rootScope, $window, $document, $q, $timeout, $mdGesture, Calendar, Component, Preferences) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
@@ -65,6 +65,18 @@
|
||||
// Compute coordinates of view element; recompute it on window resize
|
||||
angular.element($window).on('resize', updateCoordinates);
|
||||
updateCoordinates();
|
||||
|
||||
if (type != 'monthly')
|
||||
// Scroll to the day start hour defined in the user's defaults
|
||||
Preferences.ready().then(function() {
|
||||
var time, hourCell, quartersOffset;
|
||||
if (Preferences.defaults.SOGoDayStartTime) {
|
||||
time = Preferences.defaults.SOGoDayStartTime.split(':');
|
||||
hourCell = document.getElementById('hour' + parseInt(time[0]));
|
||||
quartersOffset = parseInt(time[1]) * quarterHeight;
|
||||
scrollView.scrollTop = hourCell.offsetTop + quartersOffset;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getQuarterHeight() {
|
||||
|
||||
Reference in New Issue
Block a user