create: disable shot counts an engine cannot produce
This commit is contained in:
parent
a5174a3546
commit
f19c3ea88b
1 changed files with 20 additions and 1 deletions
21
create.html
21
create.html
|
|
@ -151,6 +151,9 @@ function modelOf(id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
function shotSeconds() { return (MODEL && MODEL.shot_seconds) || 8; }
|
function shotSeconds() { return (MODEL && MODEL.shot_seconds) || 8; }
|
||||||
|
// Some engines cap total length: extension stops at 40s, so 6 shots is not
|
||||||
|
// available there. Grey it out rather than let the server silently clamp.
|
||||||
|
function maxShots() { return (MODEL && MODEL.max_shots) || 0; }
|
||||||
|
|
||||||
(async function loadFormats() {
|
(async function loadFormats() {
|
||||||
var r = await api("camera_presets", {});
|
var r = await api("camera_presets", {});
|
||||||
|
|
@ -210,9 +213,25 @@ function paintModel() {
|
||||||
var el = document.getElementById("modelnote");
|
var el = document.getElementById("modelnote");
|
||||||
el.textContent = MODEL ? (MODEL.shot_seconds + "s per shot. " + (MODEL.note || "")) : "";
|
el.textContent = MODEL ? (MODEL.shot_seconds + "s per shot. " + (MODEL.note || "")) : "";
|
||||||
var chips = document.querySelectorAll("#len .chip");
|
var chips = document.querySelectorAll("#len .chip");
|
||||||
|
var cap = maxShots();
|
||||||
for (var i = 0; i < chips.length; i++) {
|
for (var i = 0; i < chips.length; i++) {
|
||||||
var nshots = parseInt(chips[i].getAttribute("data-v"), 10);
|
var nshots = parseInt(chips[i].getAttribute("data-v"), 10);
|
||||||
chips[i].textContent = nshots + " shots · " + (nshots * shotSeconds()) + "s";
|
var over = cap && nshots > cap;
|
||||||
|
chips[i].textContent = nshots + " shots · " + (nshots * shotSeconds()) + "s"
|
||||||
|
+ (over ? " — too long for this engine" : "");
|
||||||
|
chips[i].style.opacity = over ? "0.4" : "";
|
||||||
|
chips[i].style.pointerEvents = over ? "none" : "";
|
||||||
|
// If the disabled one was selected, fall back to the largest that fits.
|
||||||
|
if (over && chips[i].classList.contains("on")) {
|
||||||
|
chips[i].classList.remove("on");
|
||||||
|
for (var j = i - 1; j >= 0; j--) {
|
||||||
|
if (!chips[j].style.pointerEvents) {
|
||||||
|
chips[j].classList.add("on");
|
||||||
|
segments = parseInt(chips[j].getAttribute("data-v"), 10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
document.getElementById("lenhint").textContent =
|
document.getElementById("lenhint").textContent =
|
||||||
"The piece is written as one continuous monologue, then cut into "
|
"The piece is written as one continuous monologue, then cut into "
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue