Fix uneven doubling on linked songs, change floor to round

master
William Toohey 10 years ago
parent 06d411ae7e
commit e3066a702b
  1. 12
      src/js/HuesEditor.js

@ -538,8 +538,8 @@ HuesEditor.prototype.halveBeats = function(editor) {
this.setText(editor, this.song[editor._rhythm].replace(/(.)./g, "$1")); this.setText(editor, this.song[editor._rhythm].replace(/(.)./g, "$1"));
if(commit) { if(commit) {
this.commitUndo(); this.commitUndo();
this.song.independentBuild = false; // We set it so any rounding is padded
this.updateInfo(); this.setIndependentBuild(false);
} }
}; };
@ -556,8 +556,8 @@ HuesEditor.prototype.doubleBeats = function(editor) {
this.setText(editor, this.song[editor._rhythm].replace(/(.)/g, "$1.")); this.setText(editor, this.song[editor._rhythm].replace(/(.)/g, "$1."));
if(commit) { if(commit) {
this.commitUndo(); this.commitUndo();
this.song.independentBuild = false; // We set it so any rounding is padded
this.updateInfo(); this.setIndependentBuild(false);
} }
}; };
@ -1000,11 +1000,11 @@ HuesEditor.prototype.setText = function(editor, text, caretFromEnd) {
} else { } else {
ratio = this.core.soundManager.buildLength / this.core.soundManager.loopLength; ratio = this.core.soundManager.buildLength / this.core.soundManager.loopLength;
} }
let newLen = Math.floor(text.length / ratio); let newLen = Math.round(text.length / ratio);
// We've tried to make the other map impossibly short, force us to be longer // We've tried to make the other map impossibly short, force us to be longer
while(newLen === 0) { while(newLen === 0) {
text += "."; text += ".";
newLen = Math.floor(text.length / ratio); newLen = Math.round(text.length / ratio);
} }
let otherMap = this.getOther(editor); let otherMap = this.getOther(editor);
let wasLocked = otherMap._locked; let wasLocked = otherMap._locked;

Loading…
Cancel
Save