Improve beatmap area resize

master
William Toohey 10 years ago
parent b6ba39f727
commit 2d7e6b1de1
  1. 7
      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,6 +109,8 @@ 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
// We only resize on a window resize event, not when dragging the handle
if(!noHilightCalc) {
var hilight = document.createElement("div"); var hilight = document.createElement("div");
hilight.className = "beat-hilight"; hilight.className = "beat-hilight";
hilight.innerHTML = "█"; hilight.innerHTML = "█";
@ -117,6 +119,7 @@ HuesEditor.prototype.resize = function() {
this.hilightHeight = hilight.clientHeight; this.hilightHeight = hilight.clientHeight;
this.editorWidth = this.loopEdit._beatmap.clientWidth; this.editorWidth = this.loopEdit._beatmap.clientWidth;
this.root.removeChild(hilight); 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