mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-20 19:20:45 +02:00
Fix hover states for toolbar buttons
This commit is contained in:
parent
b9e11f23dd
commit
9ebc0c28c8
7 changed files with 30 additions and 3 deletions
|
@ -50,12 +50,12 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: asyncClickSender.start();
|
onClicked: asyncClickSender.start();
|
||||||
onEntered: {
|
onEntered: {
|
||||||
if (hoverState > 0) {
|
if (hoverState >= 0) {
|
||||||
buttonState = hoverState;
|
buttonState = hoverState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onExited: {
|
onExited: {
|
||||||
if (defaultState > 0) {
|
if (defaultState >= 0) {
|
||||||
buttonState = defaultState;
|
buttonState = defaultState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,11 +234,16 @@ var toolBar = (function() {
|
||||||
objectName: EDIT_TOGGLE_BUTTON,
|
objectName: EDIT_TOGGLE_BUTTON,
|
||||||
imageURL: TOOL_ICON_URL + "edit.svg",
|
imageURL: TOOL_ICON_URL + "edit.svg",
|
||||||
visible: true,
|
visible: true,
|
||||||
|
alpha: 0.9,
|
||||||
buttonState: 1,
|
buttonState: 1,
|
||||||
|
hoverState: 3,
|
||||||
|
defaultState: 1,
|
||||||
});
|
});
|
||||||
activeButton.clicked.connect(function() {
|
activeButton.clicked.connect(function() {
|
||||||
that.setActive(!isActive);
|
that.setActive(!isActive);
|
||||||
activeButton.writeProperty("buttonState", isActive ? 0 : 1);
|
activeButton.writeProperty("buttonState", isActive ? 0 : 1);
|
||||||
|
activeButton.writeProperty("defaultState", isActive ? 0 : 1);
|
||||||
|
activeButton.writeProperty("hoverState", isActive ? 2 : 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
toolBar = Toolbars.getToolbar(EDIT_TOOLBAR);
|
toolBar = Toolbars.getToolbar(EDIT_TOOLBAR);
|
||||||
|
|
|
@ -56,11 +56,15 @@ var browseExamplesButton = toolBar.addButton({
|
||||||
imageURL: toolIconUrl + "market.svg",
|
imageURL: toolIconUrl + "market.svg",
|
||||||
objectName: "examples",
|
objectName: "examples",
|
||||||
buttonState: 1,
|
buttonState: 1,
|
||||||
|
defaultState: 1,
|
||||||
|
hoverState: 3,
|
||||||
alpha: 0.9
|
alpha: 0.9
|
||||||
});
|
});
|
||||||
|
|
||||||
function onExamplesWindowVisibilityChanged() {
|
function onExamplesWindowVisibilityChanged() {
|
||||||
browseExamplesButton.writeProperty('buttonState', examplesWindow.visible ? 0 : 1);
|
browseExamplesButton.writeProperty('buttonState', examplesWindow.visible ? 0 : 1);
|
||||||
|
browseExamplesButton.writeProperty('defaultState', examplesWindow.visible ? 0 : 1);
|
||||||
|
browseExamplesButton.writeProperty('hoverState', examplesWindow.visible ? 2 : 3);
|
||||||
}
|
}
|
||||||
function onClick() {
|
function onClick() {
|
||||||
toggleExamples();
|
toggleExamples();
|
||||||
|
|
|
@ -17,11 +17,15 @@ var button = toolBar.addButton({
|
||||||
imageURL: Script.resolvePath("assets/images/tools/directory.svg"),
|
imageURL: Script.resolvePath("assets/images/tools/directory.svg"),
|
||||||
visible: true,
|
visible: true,
|
||||||
buttonState: 1,
|
buttonState: 1,
|
||||||
|
defaultState: 1,
|
||||||
|
hoverState: 3,
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
});
|
});
|
||||||
|
|
||||||
function onAddressBarShown(visible) {
|
function onAddressBarShown(visible) {
|
||||||
button.writeProperty('buttonState', visible ? 0 : 1);
|
button.writeProperty('buttonState', visible ? 0 : 1);
|
||||||
|
button.writeProperty('defaultState', visible ? 0 : 1);
|
||||||
|
button.writeProperty('hoverState', visible ? 2 : 3);
|
||||||
}
|
}
|
||||||
function onClicked(){
|
function onClicked(){
|
||||||
DialogsManager.toggleAddressBar();
|
DialogsManager.toggleAddressBar();
|
||||||
|
|
|
@ -22,6 +22,8 @@ var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
|
||||||
var button;
|
var button;
|
||||||
function onHmdChanged(isHmd) {
|
function onHmdChanged(isHmd) {
|
||||||
button.writeProperty('buttonState', isHmd ? 0 : 1);
|
button.writeProperty('buttonState', isHmd ? 0 : 1);
|
||||||
|
button.writeProperty('defaultState', isHmd ? 0 : 1);
|
||||||
|
button.writeProperty('hoverState', isHmd ? 2 : 3);
|
||||||
}
|
}
|
||||||
function onClicked(){
|
function onClicked(){
|
||||||
var isDesktop = Menu.isOptionChecked(desktopMenuItemName);
|
var isDesktop = Menu.isOptionChecked(desktopMenuItemName);
|
||||||
|
@ -32,6 +34,8 @@ if (headset) {
|
||||||
objectName: "hmdToggle",
|
objectName: "hmdToggle",
|
||||||
imageURL: Script.resolvePath("assets/images/tools/switch.svg"),
|
imageURL: Script.resolvePath("assets/images/tools/switch.svg"),
|
||||||
visible: true,
|
visible: true,
|
||||||
|
hoverState: 2,
|
||||||
|
defaultState: 0,
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
});
|
});
|
||||||
onHmdChanged(HMD.active);
|
onHmdChanged(HMD.active);
|
||||||
|
|
|
@ -18,6 +18,8 @@ var button = toolbar.addButton({
|
||||||
imageURL: Script.resolvePath("assets/images/tools/ignore.svg"),
|
imageURL: Script.resolvePath("assets/images/tools/ignore.svg"),
|
||||||
visible: true,
|
visible: true,
|
||||||
buttonState: 1,
|
buttonState: 1,
|
||||||
|
defaultState: 2,
|
||||||
|
hoverState: 3,
|
||||||
alpha: 0.9
|
alpha: 0.9
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -46,6 +48,8 @@ function buttonClicked(){
|
||||||
}
|
}
|
||||||
|
|
||||||
button.writeProperty('buttonState', isShowingOverlays ? 0 : 1);
|
button.writeProperty('buttonState', isShowingOverlays ? 0 : 1);
|
||||||
|
button.writeProperty('defaultState', isShowingOverlays ? 0 : 1);
|
||||||
|
button.writeProperty('hoverState', isShowingOverlays ? 2 : 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
button.clicked.connect(buttonClicked);
|
button.clicked.connect(buttonClicked);
|
||||||
|
|
|
@ -17,13 +17,19 @@ var button = toolBar.addButton({
|
||||||
imageURL: Script.resolvePath("assets/images/tools/mic.svg"),
|
imageURL: Script.resolvePath("assets/images/tools/mic.svg"),
|
||||||
visible: true,
|
visible: true,
|
||||||
buttonState: 1,
|
buttonState: 1,
|
||||||
|
defaultState: 1,
|
||||||
|
hoverState: 3,
|
||||||
alpha: 0.9
|
alpha: 0.9
|
||||||
});
|
});
|
||||||
|
|
||||||
function onMuteToggled() {
|
function onMuteToggled() {
|
||||||
// We could just toggle state, but we're less likely to get out of wack if we read the AudioDevice.
|
// We could just toggle state, but we're less likely to get out of wack if we read the AudioDevice.
|
||||||
// muted => button "on" state => 1. go figure.
|
// muted => button "on" state => 1. go figure.
|
||||||
button.writeProperty('buttonState', AudioDevice.getMuted() ? 0 : 1);
|
var state = AudioDevice.getMuted() ? 0 : 1;
|
||||||
|
var hoverState = AudioDevice.getMuted() ? 2 : 3;
|
||||||
|
button.writeProperty('buttonState', state);
|
||||||
|
button.writeProperty('defaultState', state);
|
||||||
|
button.writeProperty('hoverState', hoverState);
|
||||||
}
|
}
|
||||||
onMuteToggled();
|
onMuteToggled();
|
||||||
function onClicked(){
|
function onClicked(){
|
||||||
|
|
Loading…
Reference in a new issue