From 2d7e6b1de173267bd01e2395504784ab6056fe11 Mon Sep 17 00:00:00 2001 From: William Toohey Date: Wed, 3 Feb 2016 22:00:33 +1000 Subject: [PATCH] Improve beatmap area resize --- src/js/HuesEditor.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/js/HuesEditor.js b/src/js/HuesEditor.js index 34ce676..8a4e61d 100644 --- a/src/js/HuesEditor.js +++ b/src/js/HuesEditor.js @@ -85,7 +85,7 @@ HuesEditor.prototype.initUI = function() { this.resize(); }; -HuesEditor.prototype.resize = function() { +HuesEditor.prototype.resize = function(noHilightCalc) { this.root.style.height = (window.innerHeight - 200) + "px"; var boxHeight = this.editArea.offsetHeight; var bHeadHeight = this.buildEdit._header.offsetHeight; @@ -109,14 +109,17 @@ HuesEditor.prototype.resize = function() { this.timeLock.style.height = (buildHeight + handleHeight) + "px"; // Save to fix Chrome rendering and to enable right click to seek - var hilight = document.createElement("div"); - hilight.className = "beat-hilight"; - hilight.innerHTML = "█"; - this.root.appendChild(hilight); - this.hilightWidth = hilight.clientWidth; - this.hilightHeight = hilight.clientHeight; - this.editorWidth = this.loopEdit._beatmap.clientWidth; - this.root.removeChild(hilight); + // We only resize on a window resize event, not when dragging the handle + if(!noHilightCalc) { + var hilight = document.createElement("div"); + hilight.className = "beat-hilight"; + hilight.innerHTML = "█"; + this.root.appendChild(hilight); + this.hilightWidth = hilight.clientWidth; + this.hilightHeight = hilight.clientHeight; + this.editorWidth = this.loopEdit._beatmap.clientWidth; + this.root.removeChild(hilight); + } } HuesEditor.prototype.createTextInput = function(label, id, subtitle, parent) { @@ -524,7 +527,7 @@ HuesEditor.prototype.uiCreateEditArea = function() { var resizer = (e) => { this.buildEditSize = Math.floor(e.clientY - editTop + handleSize/2); - this.resize(); + this.resize(true); }; var mouseup = function(e) {