From de315d62162fe5b16ebbf5cb75cdb29964e67454 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 24 Nov 2016 17:03:47 +0100 Subject: [PATCH 1/3] Touching the handle should keep the control bar visible Calling stopPropagation() was causing the normal event listeners to never get the proper events. --- app/ui.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/ui.js b/app/ui.js index 4bd5f0fb..d9142bb9 100644 --- a/app/ui.js +++ b/app/ui.js @@ -598,6 +598,8 @@ var UI; e.preventDefault(); e.stopPropagation(); + UI.keepControlbar(); + UI.activateControlbar(); }, // Move the handle but don't allow any position outside the bounds @@ -654,6 +656,8 @@ var UI; UI.toggleControlbar(); e.preventDefault(); e.stopPropagation(); + UI.keepControlbar(); + UI.activateControlbar(); } UI.controlbarGrabbed = false; }, @@ -674,6 +678,8 @@ var UI; UI.controlbarMouseDownOffsetY = ptr.clientY - bounds.top; e.preventDefault(); e.stopPropagation(); + UI.keepControlbar(); + UI.activateControlbar(); }, /* ------^------- From 8ee432f1db20f40cb3d693c80780c9c1b69820b5 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 24 Nov 2016 17:12:47 +0100 Subject: [PATCH 2/3] Allow control bar to be moved to the right side --- app/images/handle_bg.svg | 34 +++++++++---------- app/styles/base.css | 70 ++++++++++++++++++++++++++++++++++------ app/ui.js | 24 ++++++++++++++ 3 files changed, 101 insertions(+), 27 deletions(-) diff --git a/app/images/handle_bg.svg b/app/images/handle_bg.svg index b4c4d131..7579c42c 100644 --- a/app/images/handle_bg.svg +++ b/app/images/handle_bg.svg @@ -9,9 +9,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="20" + width="15" height="50" - viewBox="0 0 20 50" + viewBox="0 0 15 50" id="svg2" version="1.1" inkscape:version="0.91 r13725" @@ -29,8 +29,8 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:zoom="16" - inkscape:cx="10.515997" - inkscape:cy="22.863737" + inkscape:cx="-10.001409" + inkscape:cy="24.512566" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -63,7 +63,7 @@ image/svg+xml - + @@ -77,13 +77,13 @@ id="rect4249" width="1" height="1.0000174" - x="14.5" + x="9.5" y="1008.8622" ry="1.7382812e-05" /> (window.innerWidth * 0.9)) { + if (!anchor.classList.contains("noVNC_right")) { + UI.toggleControlbarSide(); + } + } + if (!UI.controlbarDrag) { // The goal is to trigger on a certain physical width, the // devicePixelRatio brings us a bit closer but is not optimal. From cf348b7892f772bc10c4243408eb09cff5da4818 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 26 Nov 2016 15:26:28 +0100 Subject: [PATCH 3/3] Remember control bar position --- app/ui.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/ui.js b/app/ui.js index 87ec4d0a..d4afeaa3 100644 --- a/app/ui.js +++ b/app/ui.js @@ -109,6 +109,11 @@ var UI; UI.initSetting('clip', false); } + // Restore control bar position + if (WebUtil.readSetting('controlbar_pos') === 'right') { + UI.toggleControlbarSide(); + } + // Setup and initialize event handlers UI.setupWindowEvents(); UI.setupFullscreen(); @@ -583,7 +588,13 @@ var UI; bar.addEventListener('transitionend', function () { this.style.transitionDuration = ""; }); var anchor = document.getElementById('noVNC_control_bar_anchor'); - anchor.classList.toggle("noVNC_right"); + if (anchor.classList.contains("noVNC_right")) { + WebUtil.writeSetting('controlbar_pos', 'left'); + anchor.classList.remove("noVNC_right"); + } else { + WebUtil.writeSetting('controlbar_pos', 'right'); + anchor.classList.add("noVNC_right"); + } // Consider this a movement of the handle UI.controlbarDrag = true;