mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Fixed spinner in center. Flicking only vertically
This commit is contained in:
parent
78e9bb6020
commit
3be684b973
3 changed files with 53 additions and 39 deletions
|
@ -11,8 +11,9 @@
|
|||
import QtQuick 2.5
|
||||
|
||||
AnimatedImage {
|
||||
property Item webroot: parent
|
||||
source: "../../icons/loader-snake-64-w.gif"
|
||||
visible: parent.loading && /^(http.*|)$/i.test(parent.url.toString())
|
||||
visible: webroot.loading && /^(http.*|)$/i.test(webroot.url.toString())
|
||||
z: 10000
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
|
|
|
@ -4,11 +4,12 @@ import QtWebChannel 1.0
|
|||
import "../controls-uit" as HiFiControls
|
||||
|
||||
Item {
|
||||
property alias url: root.url
|
||||
property alias scriptURL: root.userScriptUrl
|
||||
property alias canGoBack: root.canGoBack;
|
||||
property var goBack: root.goBack;
|
||||
property alias urlTag: root.urlTag
|
||||
id: root
|
||||
property alias url: webroot.url
|
||||
property alias scriptURL: webroot.userScriptUrl
|
||||
property alias canGoBack: webroot.canGoBack;
|
||||
property var goBack: webroot.goBack;
|
||||
property alias urlTag: webroot.urlTag
|
||||
property bool keyboardEnabled: true // FIXME - Keyboard HMD only: Default to false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
@ -21,17 +22,15 @@ Item {
|
|||
}
|
||||
*/
|
||||
|
||||
property alias viewProfile: root.profile
|
||||
property alias viewProfile: webroot.profile
|
||||
|
||||
Flickable {
|
||||
id: flick
|
||||
x: 0
|
||||
y: 0
|
||||
width: parent.width
|
||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
||||
|
||||
WebEngineView {
|
||||
id: root
|
||||
id: webroot
|
||||
objectName: "webEngineView"
|
||||
anchors.fill: parent
|
||||
|
||||
|
@ -58,7 +57,7 @@ Item {
|
|||
// User script.
|
||||
WebEngineScript {
|
||||
id: userScript
|
||||
sourceUrl: root.userScriptUrl
|
||||
sourceUrl: webroot.userScriptUrl
|
||||
injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
|
||||
worldId: WebEngineScript.MainWorld
|
||||
}
|
||||
|
@ -69,21 +68,25 @@ Item {
|
|||
|
||||
property string newUrl: ""
|
||||
|
||||
//disable popup
|
||||
onContextMenuRequested: {
|
||||
request.accepted = true;
|
||||
}
|
||||
|
||||
onContentsSizeChanged: {
|
||||
console.log("WebView contentsSize", contentsSize)
|
||||
flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
||||
flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
||||
flick.contentHeight = Math.max(contentsSize.height, flick.height);
|
||||
flick.contentWidth = flick.width
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
webChannel.registerObject("eventBridge", eventBridge);
|
||||
webChannel.registerObject("eventBridgeWrapper", eventBridgeWrapper);
|
||||
// Ensure the JS from the web-engine makes it to our logging
|
||||
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
|
||||
webroot.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
|
||||
console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
|
||||
});
|
||||
|
||||
root.profile.httpUserAgent = "Mozilla/5.0 Chrome (HighFidelityInterface)";
|
||||
webroot.profile.httpUserAgent = "Mozilla/5.0 Chrome (HighFidelityInterface)";
|
||||
}
|
||||
|
||||
onFeaturePermissionRequested: {
|
||||
|
@ -99,28 +102,19 @@ Item {
|
|||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||
flick.contentWidth = 0
|
||||
flick.contentHeight = 0
|
||||
flick.contentX = 0
|
||||
flick.contentY = 0
|
||||
var url = loadRequest.url.toString();
|
||||
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
|
||||
if (urlHandler.canHandleUrl(url)) {
|
||||
if (urlHandler.handleUrl(url)) {
|
||||
root.stop();
|
||||
webroot.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
||||
root.runJavaScript("document.body.scrollHeight;",
|
||||
function (i_actualPageHeight) {
|
||||
console.log("on reloaded documentElement.scrollHeigh:", i_actualPageHeight)
|
||||
flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
|
||||
})
|
||||
root.runJavaScript("document.body.scrollWidth;",
|
||||
function (i_actualPageWidth) {
|
||||
console.log("on reloaded documentElement.scrollWidth:", i_actualPageWidth)
|
||||
|
||||
flick.contentWidth = Math.max(i_actualPageWidth, flick.width);
|
||||
})
|
||||
webroot.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
|
||||
flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
|
||||
})
|
||||
flick.contentWidth = flick.width
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,11 +126,14 @@ Item {
|
|||
tabletRoot.openBrowserWindow(request, profile);
|
||||
}
|
||||
}
|
||||
|
||||
HiFiControls.WebSpinner { }
|
||||
}
|
||||
}
|
||||
|
||||
HiFiControls.WebSpinner {
|
||||
anchors.centerIn: parent
|
||||
webroot: webroot
|
||||
}
|
||||
|
||||
HiFiControls.Keyboard {
|
||||
id: keyboard
|
||||
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||
|
@ -147,5 +144,4 @@ Item {
|
|||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -138,8 +138,6 @@ Item {
|
|||
|
||||
Flickable {
|
||||
id: flick
|
||||
x: 0
|
||||
y: 0
|
||||
width: parent.width
|
||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height - web.headerHeight : parent.height - web.headerHeight
|
||||
anchors.top: buttons.bottom
|
||||
|
@ -206,12 +204,23 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
onContentsSizeChanged: {
|
||||
flick.contentHeight = Math.max(contentsSize.height, flick.height);
|
||||
flick.contentWidth = flick.width//Math.max(contentsSize.width, flick.width);
|
||||
}
|
||||
//disable popup
|
||||
onContextMenuRequested: {
|
||||
request.accepted = true;
|
||||
}
|
||||
|
||||
onLoadingChanged: {
|
||||
keyboardRaised = false;
|
||||
punctuationMode = false;
|
||||
keyboard.resetShiftMode(false);
|
||||
// Required to support clicking on "hifi://" links
|
||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||
flick.contentWidth = 0
|
||||
flick.contentHeight = 0
|
||||
var url = loadRequest.url.toString();
|
||||
if (urlHandler.canHandleUrl(url)) {
|
||||
if (urlHandler.handleUrl(url)) {
|
||||
|
@ -225,8 +234,13 @@ Item {
|
|||
}
|
||||
|
||||
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
||||
flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
||||
flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
||||
webroot.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
|
||||
flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
|
||||
})
|
||||
// webroot.runJavaScript("document.body.scrollWidth;", function (i_actualPageWidth) {
|
||||
flick.contentWidth = flick.width//Math.max(i_actualPageWidth, flick.width);
|
||||
// })
|
||||
|
||||
webview.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
@ -234,11 +248,14 @@ Item {
|
|||
onNewViewRequested: {
|
||||
request.openIn(webview);
|
||||
}
|
||||
|
||||
HiFiControls.WebSpinner { }
|
||||
}
|
||||
}
|
||||
|
||||
HiFiControls.WebSpinner {
|
||||
webroot: webview
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
HiFiControls.Keyboard {
|
||||
id: keyboard
|
||||
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||
|
|
Loading…
Reference in a new issue