Improve beatmap area resize

master
William Toohey 10 years ago
parent b6ba39f727
commit 2d7e6b1de1
  1. 23
      src/js/HuesEditor.js

@ -85,7 +85,7 @@ HuesEditor.prototype.initUI = function() {
this.resize(); this.resize();
}; };
HuesEditor.prototype.resize = function() { HuesEditor.prototype.resize = function(noHilightCalc) {
this.root.style.height = (window.innerHeight - 200) + "px"; this.root.style.height = (window.innerHeight - 200) + "px";
var boxHeight = this.editArea.offsetHeight; var boxHeight = this.editArea.offsetHeight;
var bHeadHeight = this.buildEdit._header.offsetHeight; var bHeadHeight = this.buildEdit._header.offsetHeight;
@ -109,14 +109,17 @@ HuesEditor.prototype.resize = function() {
this.timeLock.style.height = (buildHeight + handleHeight) + "px"; this.timeLock.style.height = (buildHeight + handleHeight) + "px";
// Save to fix Chrome rendering and to enable right click to seek // Save to fix Chrome rendering and to enable right click to seek
var hilight = document.createElement("div"); // We only resize on a window resize event, not when dragging the handle
hilight.className = "beat-hilight"; if(!noHilightCalc) {
hilight.innerHTML = "█"; var hilight = document.createElement("div");
this.root.appendChild(hilight); hilight.className = "beat-hilight";
this.hilightWidth = hilight.clientWidth; hilight.innerHTML = "█";
this.hilightHeight = hilight.clientHeight; this.root.appendChild(hilight);
this.editorWidth = this.loopEdit._beatmap.clientWidth; this.hilightWidth = hilight.clientWidth;
this.root.removeChild(hilight); this.hilightHeight = hilight.clientHeight;
this.editorWidth = this.loopEdit._beatmap.clientWidth;
this.root.removeChild(hilight);
}
} }
HuesEditor.prototype.createTextInput = function(label, id, subtitle, parent) { HuesEditor.prototype.createTextInput = function(label, id, subtitle, parent) {
@ -524,7 +527,7 @@ HuesEditor.prototype.uiCreateEditArea = function() {
var resizer = (e) => { var resizer = (e) => {
this.buildEditSize = Math.floor(e.clientY - editTop + handleSize/2); this.buildEditSize = Math.floor(e.clientY - editTop + handleSize/2);
this.resize(); this.resize(true);
}; };
var mouseup = function(e) { var mouseup = function(e) {

Loading…
Cancel
Save