mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 00:23:03 +00:00
feat: scroll schedule cursor into view
This commit is contained in:
committed by
Rainer Killinger
parent
42e2f3a0cb
commit
bc4c3d78db
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
@@ -25,9 +25,10 @@ import {ScheduleProvider} from '../../../calendar/schedule.provider';
|
||||
import {ScheduleEvent, ScheduleResponsiveBreakpoint} from '../schema/schema';
|
||||
import {SwiperComponent} from 'swiper/angular';
|
||||
import {InfiniteSwiperComponent} from '../grid/infinite-swiper.component';
|
||||
import {IonDatetime} from '@ionic/angular';
|
||||
import {IonContent, IonDatetime} from '@ionic/angular';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {CalendarService} from '../../../calendar/calendar.service';
|
||||
import {getScheduleCursorOffset} from '../grid/schedule-cursor-offset';
|
||||
|
||||
/**
|
||||
* Component that displays the schedule
|
||||
@@ -156,6 +157,15 @@ export class CalendarComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
}
|
||||
|
||||
async scrollCursorIntoView(content: IonContent) {
|
||||
const scrollElement = await content.getScrollElement();
|
||||
scrollElement.scrollTo({
|
||||
top:
|
||||
getScheduleCursorOffset(this.hoursRange.from, this.scale) -
|
||||
scrollElement.clientHeight / 3,
|
||||
});
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
this.uuidSubscription.unsubscribe();
|
||||
if (this.calendarServiceSubscription) {
|
||||
|
||||
Reference in New Issue
Block a user