fix: time selection click and shiftclick
This commit is contained in:
Binary file not shown.
@@ -436,7 +436,9 @@
|
|||||||
|
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
let first = true;
|
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 sampleTime = (i / sampleRate) / clipSpeed;
|
||||||
const pxLocal = xStartLocal + sampleTime * zoom;
|
const pxLocal = xStartLocal + sampleTime * zoom;
|
||||||
const y = mid - data[i] * peakRatio;
|
const y = mid - data[i] * peakRatio;
|
||||||
@@ -449,16 +451,18 @@
|
|||||||
}
|
}
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
||||||
// Draw granular sample nodes (#6ee7b7 Green Emerald, radius r = 2px) when samplesPerPixel < 1.5
|
// Draw granular sample nodes only at extreme zoom (samplesPerPixel < 0.3)
|
||||||
if (samplesPerPixel < 1.5) {
|
if (samplesPerPixel < 0.3) {
|
||||||
|
const maxNodes = 5000;
|
||||||
|
const step = Math.max(1, Math.floor((endSample - startSample) / maxNodes));
|
||||||
ctx.fillStyle = '#6ee7b7';
|
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 sampleTime = (i / sampleRate) / clipSpeed;
|
||||||
const pxLocal = xStartLocal + sampleTime * zoom;
|
const pxLocal = xStartLocal + sampleTime * zoom;
|
||||||
const y = mid - data[i] * peakRatio;
|
const y = mid - data[i] * peakRatio;
|
||||||
ctx.beginPath();
|
ctx.fillRect(pxLocal - 1, y - 1, 2, 2);
|
||||||
ctx.arc(pxLocal, y, 2, 0, Math.PI * 2);
|
drawn++;
|
||||||
ctx.fill();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user