You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
|
7 years ago
|
import { Component, OnInit } from '@angular/core';
|
||
|
|
import { Platform, Events } from '@ionic/angular';
|
||
|
|
import { KeyboardService } from '../../services/keyboard/keyboard.service';
|
||
|
|
import { KeyboardStatusModel } from '../../services/keyboard/keyboard-status.model';
|
||
|
|
|
||
|
|
@Component({
|
||
|
|
selector: 'scroll-segment-content',
|
||
|
|
templateUrl: './scroll-segment-content.component.html',
|
||
|
|
styleUrls: ['./scroll-segment-content.component.scss'],
|
||
|
|
})
|
||
|
|
export class ScrollSegmentContentComponent implements OnInit {
|
||
|
|
|
||
|
|
|
||
|
|
public keyboardOpened = false;
|
||
|
|
public className = '';
|
||
|
|
|
||
|
|
constructor(
|
||
|
|
public events: Events,
|
||
|
|
public keyboardService: KeyboardService,
|
||
|
|
public platform: Platform
|
||
|
|
) { }
|
||
|
|
|
||
|
|
ngOnInit() {
|
||
|
|
this.platform.ready().then(() => {
|
||
|
|
this.setClassName( );
|
||
|
|
this.monitorKeyboardChange();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
private monitorKeyboardChange() {
|
||
|
|
this.events.subscribe(KeyboardService.KEYBOARD_STATUS, (status: KeyboardStatusModel) => {
|
||
|
|
this.setClassName ( );
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
private setClassName () {
|
||
|
|
this.keyboardOpened = KeyboardService.keyboardOpened;
|
||
|
|
if ( this.platform.is('ios')) {
|
||
|
|
this.className = 'scroll-segment-area ios zoomIn ' + ( this.keyboardOpened ? 'keyboard-opened' : 'keyboard-closed' );
|
||
|
|
} else {
|
||
|
|
this.className = 'scroll-segment-area md zoomIn ' + ( this.keyboardOpened ? 'keyboard-opened' : 'keyboard-closed' );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|