mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 09:08:37 +02:00
Fix tablet Web view "back" button not greying out when disabled
This commit is contained in:
parent
d9540d7ece
commit
88dc6b5f61
2 changed files with 10 additions and 26 deletions
|
@ -17,26 +17,26 @@ Rectangle {
|
||||||
property alias pixelSize: label.font.pixelSize;
|
property alias pixelSize: label.font.pixelSize;
|
||||||
property bool selected: false
|
property bool selected: false
|
||||||
property bool hovered: false
|
property bool hovered: false
|
||||||
property bool enabled: false
|
|
||||||
property int spacing: 2
|
property int spacing: 2
|
||||||
property var action: function () {}
|
property var action: function () {}
|
||||||
property string enabledColor: hifi.colors.blueHighlight
|
property string enabledColor: hifi.colors.blueHighlight
|
||||||
property string disabledColor: hifi.colors.blueHighlight
|
property string disabledColor: hifi.colors.blueHighlight
|
||||||
property string highlightColor: hifi.colors.blueHighlight;
|
|
||||||
width: label.width + 64
|
width: label.width + 64
|
||||||
height: 32
|
height: 32
|
||||||
color: hifi.colors.white
|
color: hifi.colors.white
|
||||||
|
enabled: false
|
||||||
|
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: label;
|
id: label;
|
||||||
color: enabledColor
|
color: enabled ? enabledColor : disabledColor
|
||||||
font.pixelSize: 15;
|
font.pixelSize: 15;
|
||||||
anchors {
|
anchors {
|
||||||
horizontalCenter: parent.horizontalCenter;
|
horizontalCenter: parent.horizontalCenter;
|
||||||
verticalCenter: parent.verticalCenter;
|
verticalCenter: parent.verticalCenter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: indicator
|
id: indicator
|
||||||
|
|
|
@ -8,6 +8,7 @@ import "../styles" as HifiStyles
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
import "../"
|
import "../"
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: web
|
id: web
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
@ -29,7 +30,6 @@ Item {
|
||||||
property bool remove: false
|
property bool remove: false
|
||||||
property var urlList: []
|
property var urlList: []
|
||||||
property var forwardList: []
|
property var forwardList: []
|
||||||
|
|
||||||
|
|
||||||
property int currentPage: -1 // used as a model for repeater
|
property int currentPage: -1 // used as a model for repeater
|
||||||
property alias pagesModel: pagesModel
|
property alias pagesModel: pagesModel
|
||||||
|
@ -51,21 +51,22 @@ Item {
|
||||||
|
|
||||||
TabletWebButton {
|
TabletWebButton {
|
||||||
id: back
|
id: back
|
||||||
enabledColor: hifi.colors.baseGray
|
enabledColor: hifi.colors.darkGray
|
||||||
enabled: false
|
disabledColor: hifi.colors.lightGrayText
|
||||||
|
enabled: webview.canGoBack || web.urlList.length > 0 || web.forwardList.length > 0
|
||||||
text: "BACK"
|
text: "BACK"
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: goBack()
|
onClicked: goBack()
|
||||||
hoverEnabled: true
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TabletWebButton {
|
TabletWebButton {
|
||||||
id: close
|
id: close
|
||||||
enabledColor: hifi.colors.darkGray
|
enabledColor: hifi.colors.darkGray
|
||||||
|
disabledColor: hifi.colors.lightGrayText
|
||||||
|
enabled: true
|
||||||
text: "CLOSE"
|
text: "CLOSE"
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -102,11 +103,6 @@ Item {
|
||||||
id: pagesModel
|
id: pagesModel
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
currentPage = count - 1;
|
currentPage = count - 1;
|
||||||
if (currentPage > 0) {
|
|
||||||
back.enabledColor = hifi.colors.darkGray;
|
|
||||||
} else {
|
|
||||||
back.enabledColor = hifi.colors.baseGray;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,24 +161,12 @@ Item {
|
||||||
return (url === webview.url);
|
return (url === webview.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function urlAppend(url) {
|
function urlAppend(url) {
|
||||||
var lurl = decodeURIComponent(url)
|
var lurl = decodeURIComponent(url)
|
||||||
if (lurl[lurl.length - 1] !== "/") {
|
if (lurl[lurl.length - 1] !== "/") {
|
||||||
lurl = lurl + "/"
|
lurl = lurl + "/"
|
||||||
}
|
}
|
||||||
web.urlList.push(url);
|
web.urlList.push(url);
|
||||||
setBackButtonStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setBackButtonStatus() {
|
|
||||||
if (web.urlList.length > 0 || webview.canGoBack) {
|
|
||||||
back.enabledColor = hifi.colors.darkGray;
|
|
||||||
back.enabled = true;
|
|
||||||
} else {
|
|
||||||
back.enabledColor = hifi.colors.baseGray;
|
|
||||||
back.enabled = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onUrlChanged: {
|
onUrlChanged: {
|
||||||
|
|
Loading…
Reference in a new issue