melhorando a leitura de projetos no mmpCreator
Deploy / Deploy (push) Successful in 2m13s Details

This commit is contained in:
JotaChina 2025-12-25 13:08:03 -03:00
parent 0beb9cddb5
commit d7d43c6a83
1 changed files with 5 additions and 6 deletions

View File

@ -248,7 +248,7 @@ export function renderAudioEditor() {
const menu = document.getElementById("ruler-context-menu");
const currentPixelsPerSecond = getPixelsPerSecond();
const rect = newRuler.getBoundingClientRect();
const scrollLeft = newRuler.scrollLeft;
const scrollLeft = scrollEl.scrollLeft;
const clickX = e.clientX - rect.left;
const absoluteX = clickX + scrollLeft;
const clickTime = absoluteX / currentPixelsPerSecond;
@ -527,15 +527,15 @@ export function renderAudioEditor() {
.forEach((g) => (g.style.width = `${widthPx}px`));
}
// Sync Scroll
newTrackContainer.addEventListener("scroll", () => {
newTrackContainer.addEventListener("scroll", () => {
const scrollPos = scrollEl.scrollLeft;
// sincroniza régua com o container
const mainRuler = tracksParent.querySelector(".timeline-ruler");
if (mainRuler && mainRuler.scrollLeft !== scrollPos) {
mainRuler.scrollLeft = scrollPos; // funciona com overflow hidden (scroll programático)
mainRuler.scrollLeft = scrollPos;
}
});
// expansão "infinita"
const threshold = 300;
@ -545,16 +545,15 @@ export function renderAudioEditor() {
if (rightEdge > currentWidth - threshold) {
const newWidth = Math.ceil(currentWidth * 1.5);
// aplica widths
applyTimelineWidth(newWidth);
// adiciona mais marcadores na régua (sem re-render geral)
const rulerEl = tracksParent.querySelector(".timeline-ruler");
appendRulerMarkers(rulerEl, currentWidth, newWidth, barWidthPx);
}
});
// Event Listener Principal (mousedown)
newTrackContainer.addEventListener("mousedown", (e) => {
document.getElementById("timeline-context-menu").style.display = "none";