summaryrefslogtreecommitdiff
path: root/tools/mq_editor/viewer.js
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-18 06:59:32 +0100
committerskal <pascal.massimino@gmail.com>2026-02-18 06:59:32 +0100
commit105c817021a84bfacffa1553d6bcd536808b9f23 (patch)
tree36bc576d4605c5057e1604640f0fa1679866d6b6 /tools/mq_editor/viewer.js
parent65cd99553cd688c5ad2cfd64d79c6434fe694a33 (diff)
feat(mq_editor): UI improvements and partial detection enhancements
- Right panel with synthesis checkboxes (integrate phase, disable jitter, disable spread) - Style file chooser as button; show filename next to page title - Second backward pass in extractPartials to recover partial onsets - Cursor line drawn on overlay canvas (no full redraw on mousemove) handoff(Claude): UI + algo improvements complete
Diffstat (limited to 'tools/mq_editor/viewer.js')
-rw-r--r--tools/mq_editor/viewer.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/mq_editor/viewer.js b/tools/mq_editor/viewer.js
index e19ec3a..ebf4fab 100644
--- a/tools/mq_editor/viewer.js
+++ b/tools/mq_editor/viewer.js
@@ -33,6 +33,10 @@ class SpectrogramViewer {
// Partial keep count (Infinity = all kept)
this.keepCount = Infinity;
+ // Mouse cursor overlay
+ this.cursorCanvas = document.getElementById('cursorCanvas');
+ this.cursorCtx = this.cursorCanvas ? this.cursorCanvas.getContext('2d') : null;
+
// Playhead
this.playheadTime = -1; // -1 = not playing
@@ -122,6 +126,20 @@ class SpectrogramViewer {
this.renderSpectrum();
}
+ drawMouseCursor(x) {
+ if (!this.cursorCtx) return;
+ const ctx = this.cursorCtx;
+ const h = this.cursorCanvas.height;
+ ctx.clearRect(0, 0, this.cursorCanvas.width, h);
+ if (x < 0) return;
+ ctx.strokeStyle = 'rgba(255, 60, 60, 0.7)';
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.moveTo(x, 0);
+ ctx.lineTo(x, h);
+ ctx.stroke();
+ }
+
drawPlayhead() {
if (this.playheadTime < 0) return;
if (this.playheadTime < this.t_view_min || this.playheadTime > this.t_view_max) return;
@@ -380,12 +398,14 @@ class SpectrogramViewer {
setupMouseHandlers() {
const {canvas, tooltip} = this;
- // Mouse move (tooltip)
+ // Mouse move (tooltip + cursor)
canvas.addEventListener('mousemove', (e) => {
const rect = canvas.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
+ this.drawMouseCursor(x);
+
const time = this.canvasToTime(x);
const freq = this.canvasToFreq(y);
const intensity = this.getIntensityAt(time, freq);
@@ -403,6 +423,7 @@ class SpectrogramViewer {
});
canvas.addEventListener('mouseleave', () => {
+ this.drawMouseCursor(-1);
tooltip.style.display = 'none';
});