fix: time selection click and shiftclick

This commit is contained in:
2026-07-20 19:45:48 +07:00
parent 85a8dc6d17
commit f616e1fd70
2 changed files with 11 additions and 7 deletions
+11 -7
View File
@@ -436,7 +436,9 @@
ctx.beginPath();
let first = true;
for (let i = startSample; i < endSample; i++) {
const maxSamples = 50000;
const vectorStep = Math.max(1, Math.floor((endSample - startSample) / maxSamples));
for (let i = startSample; i < endSample; i += vectorStep) {
const sampleTime = (i / sampleRate) / clipSpeed;
const pxLocal = xStartLocal + sampleTime * zoom;
const y = mid - data[i] * peakRatio;
@@ -449,16 +451,18 @@
}
ctx.stroke();
// Draw granular sample nodes (#6ee7b7 Green Emerald, radius r = 2px) when samplesPerPixel < 1.5
if (samplesPerPixel < 1.5) {
// Draw granular sample nodes only at extreme zoom (samplesPerPixel < 0.3)
if (samplesPerPixel < 0.3) {
const maxNodes = 5000;
const step = Math.max(1, Math.floor((endSample - startSample) / maxNodes));
ctx.fillStyle = '#6ee7b7';
for (let i = startSample; i < endSample; i++) {
let drawn = 0;
for (let i = startSample; i < endSample && drawn < maxNodes; i += step) {
const sampleTime = (i / sampleRate) / clipSpeed;
const pxLocal = xStartLocal + sampleTime * zoom;
const y = mid - data[i] * peakRatio;
ctx.beginPath();
ctx.arc(pxLocal, y, 2, 0, Math.PI * 2);
ctx.fill();
ctx.fillRect(pxLocal - 1, y - 1, 2, 2);
drawn++;
}
}
} else {