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) => {
|
inputs.forEach((input) => {
|
||||||
input.addEventListener("input", (event) => {
|
input.addEventListener("input", (event) => {
|
||||||
enforceNumericInput(event);
|
enforceNumericInput(event);
|
||||||
if (
|
const id = event.target.id;
|
||||||
appState.global.isPlaying &&
|
const affectsTimeline = id === "bars-input" || id.startsWith("compasso-");
|
||||||
(event.target.id.startsWith("compasso-") ||
|
|
||||||
event.target.id === "bars-input")
|
// ✅ só para se for o usuário digitando/colando (evento real)
|
||||||
) {
|
if (appState.global.isPlaying && affectsTimeline && event.isTrusted) {
|
||||||
sendAction({ type: "STOP_PLAYBACK" });
|
sendAction({ type: "STOP_PLAYBACK" });
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
input.addEventListener("change", (event) => {
|
input.addEventListener("change", (event) => {
|
||||||
const target = event.target;
|
const target = event.target;
|
||||||
|
|
@ -450,11 +449,19 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
input.addEventListener("wheel", (event) => {
|
input.addEventListener("wheel", (event) => {
|
||||||
event.preventDefault();
|
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;
|
const step = event.deltaY < 0 ? 1 : -1;
|
||||||
adjustValue(event.target, step);
|
adjustValue(event.target, step);
|
||||||
event.target.dispatchEvent(new Event("change", { bubbles: true }));
|
event.target.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
const buttons = document.querySelectorAll(".adjust-btn");
|
const buttons = document.querySelectorAll(".adjust-btn");
|
||||||
buttons.forEach((button) => {
|
buttons.forEach((button) => {
|
||||||
|
|
@ -463,6 +470,11 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
const targetInput = document.getElementById(targetId);
|
const targetInput = document.getElementById(targetId);
|
||||||
const step = parseInt(button.dataset.step, 10) || 1;
|
const step = parseInt(button.dataset.step, 10) || 1;
|
||||||
if (targetInput) {
|
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);
|
adjustValue(targetInput, step);
|
||||||
targetInput.dispatchEvent(new Event("change", { bubbles: true }));
|
targetInput.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue