简体   繁体   English

更改方向时调整Cordova相机的大小

[英]Cordova camera resize on orientation change

When taking a photo via navigator.camera.getPicture and changing the device's orientation inside the photo interface, the webview's viewport doesn't resize upon returning. 通过navigator.camera.getPicture拍照并在照片界面中更改设备的方向时,返回时Webview的视口不会调整大小。 The blank space is not part of the HTML document, so internal resizing in the app doesn't help. 空格不是HTML文档的一部分,因此应用程序内部的大小调整无济于事。

A plugin bug? 插件错误? Is there a way to force resizing on the cordova / webview layer? 有没有办法在cordova / webview图层上强制调整大小?

That's the result of starting vertical, opening the photo interface, turning into horizontal and returning to the app: 这是开始垂直,打开照片界面,变为水平并返回到应用程序的结果: 在此处输入图片说明

Dirty fix after returning from the camera interface: 从摄像头界面返回后的脏污修复:

fixCordovaCameraBug: function() {
    if (... == 'iOS') {
        var actions = window.StatusBar.isVisible ? ['hide', 'show'] : ['show', 'hide'];
        window.StatusBar[actions[0]]();
        window.StatusBar[actions[1]]();
        window.setTimeout(function() {
            // framework specific
            Ext.GlobalEvents.fireResize();
        }, 1);
    }
},

这只是通过cordova-plugin-statusbar@2.2.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM