Commit Graph
4 Commits
Author SHA1 Message Date
Sameh KhamisandManjunath Paparaju 22485dcb01 Street Level photo viewer: a failed mount spares the next, stable keyless ranks
Second review follow-ups:

- A mount woken without being drawn unmounts only its own presentation:
  an earlier mount overtaken by a second mount of the same viewer fails
  as closed and leaves the second one mounted and presented.
- A mount whose last view left fails only if no view has subscribed
  since; one subscribed in the same tick draws it.
- Mount keys come from photoViewers.js's nextViewKey(), and a keyless
  presentation is stamped from the same counter when any picker first
  sees it, kept until it presents null: its rank no longer depends on the
  picker's lifetime or the order it subscribes in.
- A canvas handed back while a panorama's open waits on its draw takes
  the panorama: the open builds its renderer there instead of falling
  back to the front view. A canvas the panorama moved off is not moved
  back to, so two views drawing their own cannot take it in turns.
- The guard test also refuses compound writes (+=, ||=, ??=, &&=…),
  destructuring writes to properties, Object.assign (other than onto a
  new Error), Object.defineProperty and Reflect.set, and a catch binding
  that shadows loadImage's image.

Nothing changes in the running app.

Co-authored-by: Manjunath Paparaju <[email protected]>
2026-11-19 16:23:42 -08:00
Sameh KhamisandManjunath Paparaju e6f21777ba Street Level photo viewer: keyless ranking, closed waits, a moved canvas
Review follow-ups to the previous commit:

- photoViewers.js ranks a presentation without a mountKey as mounted when
  it began presenting (after the latest key seen, before any later mount),
  so a photo viewer mounting while a keyless one shows is drawn and the
  keyless one superseded; supersede is queued whenever more than one
  presents after any change, not only when the pick changes.
- A panorama's open still waiting on a draw when the last view leaves
  fails as closed and leaves no photo shown, instead of uploading to a
  canvas never drawn. A mount waiting on its first draw then also fails as
  closed and is unmounted, so a view subscribing later sees nothing.
- A view handing back another canvas element than the renderer's drops
  the renderer and draws the panorama again on the new one, as after a
  lost context.
- The guard test allows a .src write in loadImage only on the one `image`
  binding, created by new Image() and never rebound or shadowed, and
  refuses `(expr).src =` and bracket property writes anywhere.
- The test fakes' shared view is reset before each test
  (resetPhotoView), so a viewer left by an earlier test is neither drawn
  with nor superseded by a later test's.

Nothing changes in the running app.

Co-authored-by: Manjunath Paparaju <[email protected]>
2026-11-19 16:04:21 -08:00
Sameh KhamisandManjunath Paparaju 33ac0545ef Street Level photo viewer: settle opens, a gapless picker, a stated contract
Follow-ups to the photo viewer's move to a Vue view (#1868):

- A panorama's open waits for a draw of the canvas counted from before it
  is shown, so a view that draws at once inside its listener no longer
  leaves the open pending; and when the last view unsubscribes, an open
  waiting on a draw goes on instead of hanging.
- photoViewers.js supersedes the mounts not drawn on a microtask, after
  the winning presentation has reached every subscriber: a second
  subscriber sees the earlier mount, then the later one, never null
  between.
- A presentation without a mountKey counts as the latest mount (among
  several without, the one that began presenting last), and one without
  actions or supersede is passed over without throwing. Both fields are
  documented on ViewerAdapter.subscribeView in registry.js and in the
  store's comment.
- The guard test also refuses .width, .height, .ariaLabel, .id and .value
  writes in photoViewer.js, and .src writes outside loadImage, where only
  the off-page Image it creates may take one.
- The test fakes draw every viewer through one shared view behind
  photoViewers.js's picker, as the application does, so provider and
  layer tests see supersede.

Nothing changes in the running app.

Co-authored-by: Manjunath Paparaju <[email protected]>
2026-11-19 15:48:50 -08:00
Sameh KhamisandManjunath Paparaju 2a0e21774b Street Level photo viewer: fresh elements per mount, and one viewer drawn
Fixes from review of the move to StreetLevelPhotoViewer:

- Each mount and each panorama canvas now takes a key no viewer reuses,
  and the view keys its root by the mount. Before, switching KartaView and
  Panoramax in one tick let Vue patch the old viewer's canvas, whose
  destroyed renderer had lost its context, into the new one, so 360°
  photos fell back to their front view.
- Of the viewers mounting in the host, the view draws the one mounted
  last, by mount key (photoViewers.js, which subscribePhotoViewer() now
  uses), whatever order they present in. A viewer still mounting when a
  later one is drawn is superseded: it unmounts and its mount fails as
  closed, rather than staying pending and being drawn once the later one
  goes.
- A panorama's first image is uploaded once the view has drawn its canvas
  shown (the view hands the canvas back on every draw), so it is never
  sized into a hidden canvas.
- The tests' fake view now draws as Vue does: once per tick with the final
  value, keeping elements while their keys are unchanged and handing every
  element back on each draw. StreetLevelPhotoViewer.test.mjs covers the
  switch in one tick and the overtaken mount with the real view.
- The guard test's check that the photo viewer writes no DOM covers
  inserting, moving, removing and replacing elements, attributes, classes,
  styles and the hidden, disabled and text properties.

Co-authored-by: Manjunath Paparaju <[email protected]>
2026-11-19 13:52:36 -08:00