corrigindo play/stop do editor de patterns
Deploy / Deploy (push) Successful in 2m5s
Details
Deploy / Deploy (push) Successful in 2m5s
Details
This commit is contained in:
parent
cca6100b96
commit
f8de93a9f3
|
|
@ -426,14 +426,13 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
inputs.forEach((input) => {
|
||||
input.addEventListener("input", (event) => {
|
||||
enforceNumericInput(event);
|
||||
if (
|
||||
appState.global.isPlaying &&
|
||||
(event.target.id.startsWith("compasso-") ||
|
||||
event.target.id === "bars-input")
|
||||
) {
|
||||
const id = event.target.id;
|
||||
const affectsTimeline = id === "bars-input" || id.startsWith("compasso-");
|
||||
|
||||
// ✅ só para se for o usuário digitando/colando (evento real)
|
||||
if (appState.global.isPlaying && affectsTimeline && event.isTrusted) {
|
||||
sendAction({ type: "STOP_PLAYBACK" });
|
||||
}
|
||||
});
|
||||
|
||||
input.addEventListener("change", (event) => {
|
||||
const target = event.target;
|
||||
|
|
@ -450,11 +449,19 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
|
||||
input.addEventListener("wheel", (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const id = event.target.id;
|
||||
const affectsTimeline = id === "bars-input" || id.startsWith("compasso-");
|
||||
|
||||
// ✅ mantém o comportamento atual: mexeu em bars/compasso enquanto toca → para
|
||||
if (appState.global.isPlaying && affectsTimeline) {
|
||||
sendAction({ type: "STOP_PLAYBACK" });
|
||||
}
|
||||
|
||||
const step = event.deltaY < 0 ? 1 : -1;
|
||||
adjustValue(event.target, step);
|
||||
event.target.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
});
|
||||
});
|
||||
|
||||
const buttons = document.querySelectorAll(".adjust-btn");
|
||||
buttons.forEach((button) => {
|
||||
|
|
@ -463,6 +470,11 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
const targetInput = document.getElementById(targetId);
|
||||
const step = parseInt(button.dataset.step, 10) || 1;
|
||||
if (targetInput) {
|
||||
const id = targetInput.id;
|
||||
const affectsTimeline = id === "bars-input" || id.startsWith("compasso-");
|
||||
if (appState.global.isPlaying && affectsTimeline) {
|
||||
sendAction({ type: "STOP_PLAYBACK" });
|
||||
}
|
||||
adjustValue(targetInput, step);
|
||||
targetInput.dispatchEvent(new Event("change", { bubbles: true }));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue