mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 22:09:02 +02:00
Fix width of html pages in Create mode
This commit is contained in:
parent
9fd2a742a9
commit
43d3544a0d
1 changed files with 19 additions and 22 deletions
|
@ -4,6 +4,9 @@ import QtWebChannel 1.0
|
||||||
import "../controls-uit" as HiFiControls
|
import "../controls-uit" as HiFiControls
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
width: parent !== null ? parent.width : undefined
|
||||||
|
height: parent !== null ? parent.height : undefined
|
||||||
|
|
||||||
property alias url: root.url
|
property alias url: root.url
|
||||||
property alias scriptURL: root.userScriptUrl
|
property alias scriptURL: root.userScriptUrl
|
||||||
property alias canGoBack: root.canGoBack;
|
property alias canGoBack: root.canGoBack;
|
||||||
|
@ -25,12 +28,9 @@ Item {
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: flick
|
id: flick
|
||||||
x: 0
|
|
||||||
y: 0
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
|
||||||
|
|
||||||
|
|
||||||
WebEngineView {
|
WebEngineView {
|
||||||
id: root
|
id: root
|
||||||
objectName: "webEngineView"
|
objectName: "webEngineView"
|
||||||
|
@ -86,9 +86,13 @@ Item {
|
||||||
|
|
||||||
onContentsSizeChanged: {
|
onContentsSizeChanged: {
|
||||||
console.log("WebView contentsSize", contentsSize)
|
console.log("WebView contentsSize", contentsSize)
|
||||||
flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
flick.contentWidth = flick.width
|
||||||
flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
||||||
}
|
}
|
||||||
|
//disable popup
|
||||||
|
onContextMenuRequested: {
|
||||||
|
request.accepted = true;
|
||||||
|
}
|
||||||
|
|
||||||
onLoadingChanged: {
|
onLoadingChanged: {
|
||||||
keyboardRaised = false;
|
keyboardRaised = false;
|
||||||
|
@ -97,6 +101,8 @@ Item {
|
||||||
|
|
||||||
// Required to support clicking on "hifi://" links
|
// Required to support clicking on "hifi://" links
|
||||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||||
|
flick.contentWidth = 0
|
||||||
|
flick.contentHeight = 0
|
||||||
var url = loadRequest.url.toString();
|
var url = loadRequest.url.toString();
|
||||||
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
|
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
|
||||||
if (urlHandler.canHandleUrl(url)) {
|
if (urlHandler.canHandleUrl(url)) {
|
||||||
|
@ -106,22 +112,10 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
if (WebEngineView.LoadSucceededStatus == loadRequest.status) {
|
||||||
|
root.runJavaScript("document.body.scrollHeight;", function (i_actualPageHeight) {
|
||||||
// flick.contentWidth = Math.max(contentsSize.width, flick.width)
|
flick.contentHeight = Math.max(i_actualPageHeight, flick.height);
|
||||||
// flick.contentHeight = Math.max(contentsSize.height, flick.height)
|
})
|
||||||
root.runJavaScript(
|
flick.contentWidth = flick.width
|
||||||
"document.body.scrollHeight;",
|
|
||||||
function (i_actualPageHeight) {
|
|
||||||
flick.contentHeight = Math.max (
|
|
||||||
i_actualPageHeight, flick.height);
|
|
||||||
})
|
|
||||||
root.runJavaScript(
|
|
||||||
"document.body.scrollWidth;",
|
|
||||||
function (i_actualPageWidth) {
|
|
||||||
flick.contentWidth = Math.max (
|
|
||||||
i_actualPageWidth, flick.width);
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,11 +127,14 @@ Item {
|
||||||
tabletRoot.openBrowserWindow(request, profile);
|
tabletRoot.openBrowserWindow(request, profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HiFiControls.WebSpinner { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HiFiControls.WebSpinner {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
webroot: root
|
||||||
|
}
|
||||||
|
|
||||||
HiFiControls.Keyboard {
|
HiFiControls.Keyboard {
|
||||||
id: keyboard
|
id: keyboard
|
||||||
raised: parent.keyboardEnabled && parent.keyboardRaised
|
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||||
|
|
Loading…
Reference in a new issue