Phase 6 WIP working

This commit is contained in:
Dejvino
2026-08-05 12:20:55 +02:00
parent 968101c532
commit d0f93e5c55
3 changed files with 37 additions and 9 deletions
+20 -4
View File
@@ -23,14 +23,30 @@ export class TimelineStrip {
this.frame = 0;
this.hoverFrame = -1;
this.loopSection = -1;
this.isDragging = false;
canvas.addEventListener('pointerdown', (e) => this._seekFromEvent(e));
canvas.addEventListener('pointerdown', (e) => {
this.isDragging = true;
this._seekFromEvent(e, { warmup: false });
});
canvas.addEventListener('pointermove', (e) => {
const rect = canvas.getBoundingClientRect();
this.hoverFrame = this._frameAt(e.clientX - rect.left, rect.width);
if (e.buttons & 1) this._seekFromEvent(e);
if (this.isDragging || (e.buttons & 1)) {
this.isDragging = true;
this._seekFromEvent(e, { warmup: false });
}
});
canvas.addEventListener('pointerleave', () => { this.hoverFrame = -1; });
window.addEventListener('pointerup', () => {
if (this.isDragging) {
this.isDragging = false;
if (this.onSeek && this.show && this.show.ready) {
this.onSeek(this.frame, { warmup: true });
}
}
});
}
setShow(show) { this.show = show; }
@@ -42,10 +58,10 @@ export class TimelineStrip {
return Math.round((x / Math.max(1, width)) * (this.show.frameCount - 1));
}
_seekFromEvent(event) {
_seekFromEvent(event, options = {}) {
if (!this.onSeek || !this.show || !this.show.ready) return;
const rect = this.canvas.getBoundingClientRect();
this.onSeek(this._frameAt(event.clientX - rect.left, rect.width));
this.onSeek(this._frameAt(event.clientX - rect.left, rect.width), options);
}
resize() {