Fix goto and expand displaying as hovered when redisplay mini tablet

This commit is contained in:
David Rowe 2018-09-08 16:41:36 +12:00
parent 5fcb69c724
commit 66f75e856e
2 changed files with 41 additions and 7 deletions

View file

@ -64,6 +64,10 @@ img {
background-image: url("./img/mt-goto-hover.svg");
}
#goto:hover.unhover {
background-image: url("./img/mt-goto-normal.svg");
}
#expand {
position: absolute;
right: 1px;
@ -78,6 +82,10 @@ img {
background-image: url("./img/mt-expand-hover.svg");
}
#expand:hover.unhover {
background-image: url("./img/mt-expand-normal.svg");
}
#expand img {
width:34px;
margin-top: 7px;

View file

@ -26,7 +26,30 @@
muteImage,
gotoButton,
gotoImage,
expandButton;
expandButton,
// Work around buttons staying hovered when mini tablet is replaced by tablet proper then subsequently redisplayed.
isUnhover = true;
// #region Utilites ========================================================================================================
function setUnhover() {
if (!isUnhover) {
gotoButton.classList.add("unhover");
expandButton.classList.add("unhover");
isUnhover = true;
}
}
function clearUnhover() {
if (isUnhover) {
gotoButton.classList.remove("unhover");
expandButton.classList.remove("unhover");
isUnhover = false;
}
}
// #endregion
// #region Communications ==================================================================================================
@ -50,25 +73,28 @@
}
}
function onButtonHover() {
EventBridge.emitWebEvent(JSON.stringify({
type: HOVER_MESSAGE
}));
clearUnhover();
}
function onMuteButtonClick() {
EventBridge.emitWebEvent(JSON.stringify({
type: MUTE_MESSAGE
}));
}
function onButtonHover() {
EventBridge.emitWebEvent(JSON.stringify({
type: HOVER_MESSAGE
}));
}
function onGotoButtonClick() {
setUnhover();
EventBridge.emitWebEvent(JSON.stringify({
type: GOTO_MESSAGE
}));
}
function onExpandButtonClick() {
setUnhover();
EventBridge.emitWebEvent(JSON.stringify({
type: EXPAND_MESSAGE
}));