I’m trying to resize signature pad to fill the available content area, but faced with issue that content size is equals to zero when device orientation change event fires.
You can see in onDeviceOrientationChanged function content width/height properties equals to zero. I tried to play with timeout in onDeviceOrientationChanged, sometimes it helps, sometimes dimension still equals zero.
Please advice
constructor(
private navCtrl: NavController,
private navParams: NavParams,
private viewCtrl: ViewController) { }
ngAfterViewInit() {
this.orientationChange$ = Observable.fromEvent(window, 'orientationchange');
this.orientationChangeSubscription = this.orientationChange$.subscribe(this.onDeviceOrientationChanged.bind(this));
}
ionViewDidLoad() {
ScreenOrientation.lockOrientation('landscape');
}
private onDeviceOrientationChanged(e) {
let content = this.viewCtrl.getIONContent();
let orientation = ScreenOrientation.orientation;
let contentWidth = content.contentWidth; // equals 0
let contentHeight = content.contentHeight; // equals 0
}