Only disable animation when element is displayed
The transitionend event will not fire when display=none. This can prevent the initial animation for hiding the controlbar in some cases.
This commit is contained in:
parent
d7a575a2c8
commit
06309160ee
11
app/ui.js
11
app/ui.js
|
@ -549,10 +549,15 @@ var UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleControlbarSide: function () {
|
toggleControlbarSide: function () {
|
||||||
// Temporarily disable animation to avoid weird movement
|
// Temporarily disable animation, if bar is displayed, to avoid weird
|
||||||
|
// movement. The transitionend-event will not fire when display=none.
|
||||||
var bar = document.getElementById('noVNC_control_bar');
|
var bar = document.getElementById('noVNC_control_bar');
|
||||||
bar.style.transitionDuration = '0s';
|
var barDisplayStyle = window.getComputedStyle(bar).display;
|
||||||
bar.addEventListener('transitionend', function () { this.style.transitionDuration = ""; });
|
if (barDisplayStyle !== 'none') {
|
||||||
|
bar.style.transitionDuration = '0s';
|
||||||
|
bar.addEventListener('transitionend', function () {
|
||||||
|
this.style.transitionDuration = ""; });
|
||||||
|
}
|
||||||
|
|
||||||
var anchor = document.getElementById('noVNC_control_bar_anchor');
|
var anchor = document.getElementById('noVNC_control_bar_anchor');
|
||||||
if (anchor.classList.contains("noVNC_right")) {
|
if (anchor.classList.contains("noVNC_right")) {
|
||||||
|
|
Loading…
Reference in New Issue