mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-01 20:29:00 +00:00
zoom: _saveZoom is view-only — editor 500% can no longer leak into the per-space store
The exit-editor restore re-saved the view zoom from a rAF; on a slow
tablet the floor-tab click lands before that rAF (input runs first in
the frame), the snap.space guard skipped the fix-up save and the editor
wheel zoom (500%) stayed in _zoomBySpace/LS_ZOOM — the second floor
switch brought it back into view mode (owner's dacha report). Now
_saveZoom simply refuses to write while _mode is not 'view': the wheel
inside the editors keeps zooming but never touches the per-space view
store, so no fix-up is needed at all. The snapshot restore keeps
bringing the pre-editor viewport back. Smoke: smoke_zoom_out.mjs grows
the owner's exact scenario (both floors zoomed in view, editor 5.0,
same-tick switch after exit, two floor switches) — red before, green
now; the 6d16f69 asserts stay green.
This commit is contained in:
@@ -1543,8 +1543,16 @@ class HouseplanCard extends LitElement {
|
||||
this._saveZoom();
|
||||
}
|
||||
|
||||
/** Save the current space zoom to localStorage. */
|
||||
/** Save the current space zoom to localStorage (view mode only). */
|
||||
private _saveZoom(): void {
|
||||
// Editor zoom is a working tool, never the viewing intent: while an editor
|
||||
// is open the wheel/pinch keep calling _saveZoom, but the per-space VIEW
|
||||
// zoom must not learn about it. The exit-editor restore used to re-save the
|
||||
// view zoom from a rAF — on a slow tablet the floor-tab click lands BEFORE
|
||||
// that rAF (input runs first in the frame), the space guard skipped the
|
||||
// fix-up and the editor 500% stayed in _zoomBySpace/LS_ZOOM for the next
|
||||
// visit to that floor. Editors do not need zoom persistence at all.
|
||||
if (this._mode !== 'view') return;
|
||||
this._zoomBySpace = { ...this._zoomBySpace, [this._space]: this._zoom };
|
||||
try {
|
||||
localStorage.setItem(LS_ZOOM, JSON.stringify(this._zoomBySpace));
|
||||
|
||||
Reference in New Issue
Block a user