@dawcore/components 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3778,6 +3778,15 @@ var DawEditorElement = class extends LitElement10 {
3778
3778
  v.scrollSelector = ".scroll-area";
3779
3779
  return v;
3780
3780
  })();
3781
+ /**
3782
+ * Cache of the last ViewportState forwarded to the spectrogram controller.
3783
+ * Lit's `updated()` fires on every reactive state change (`_isPlaying`,
3784
+ * `_selectedTrackId`, etc.) — most of which don't affect the spectrogram
3785
+ * viewport. Skip the cross-controller call when nothing changed.
3786
+ *
3787
+ * The orchestrator dedupes too, but this avoids the call entirely.
3788
+ */
3789
+ this._lastSpectrogramViewport = null;
3781
3790
  // --- Track Events ---
3782
3791
  this._onTrackConnected = (e) => {
3783
3792
  const trackId = e.detail?.trackId;
@@ -4314,7 +4323,11 @@ var DawEditorElement = class extends LitElement10 {
4314
4323
  if (this._spectrogramController) {
4315
4324
  const vs = this._viewport.visibleStart;
4316
4325
  const ve = this._viewport.visibleEnd;
4326
+ const spp = this._renderSpp;
4317
4327
  if (Number.isFinite(vs) && Number.isFinite(ve)) {
4328
+ const prev = this._lastSpectrogramViewport;
4329
+ if (prev && prev.vs === vs && prev.ve === ve && prev.spp === spp) return;
4330
+ this._lastSpectrogramViewport = { vs, ve, spp };
4318
4331
  const span = ve - vs;
4319
4332
  const bufferPad = span * 0.25;
4320
4333
  this._spectrogramController.setViewport({
@@ -4322,7 +4335,7 @@ var DawEditorElement = class extends LitElement10 {
4322
4335
  visibleEndPx: ve,
4323
4336
  bufferStartPx: Math.max(0, vs - bufferPad),
4324
4337
  bufferEndPx: ve + bufferPad,
4325
- samplesPerPixel: this._renderSpp
4338
+ samplesPerPixel: spp
4326
4339
  });
4327
4340
  }
4328
4341
  }