- Map view (and the navigator) no longer draw tiles centred inside a private saved
location until the user chooses Show Map; the choice resets on library switch.
- Pins, cluster badges, location circles and track marks use theme Tokens (map_*)
instead of file-level colour constants.
- map.trackLog keeps the 50 MB cap; photo.autoTagTracklog keeps its previous 256 MB cap.
From review on #4243:
- Opening another library resets the Map view's state that names the old one's
photos or saved locations (MapUi::library_changed): ids are per library, so B's
location 3 no longer inherits A's Delete… confirmation.
- A GPX is read with lossy UTF-8 again: a stray Latin-1 byte in a track name no
longer refuses the file (photo.autoTagTracklog always read it that way). The
50 MB cap stays: the Map view keeps the whole parsed log in memory.
- The navigator counts each saved location's photos with one PositionIndex (its
band of latitudes, not every point), and a rating or label change, which
rebuilds the points without moving any, no longer counts them again.
- map.filterPhotos reads positions through valid_gps (an out-of-range one is
untagged, as in the Map view and Has GPS); `bounds` is documented as the area of
mode "visible".
- A 200 marked no-store takes an older copy of the tile off the disk.
- map.setView: the doc comment, message and docs say what is applied (0…24,
shown within the map style's range).
- act takes the map's view as one argument instead of silencing the lint.
- The Map view's interface surfaces (notes, hover card, filter bar, toolbar,
legend, loupe card, navigator, saved-locations text) use the theme's tokens; the
marks drawn on the map's tiles (pins, badges, credit plate, circles, track) are
named constants, the tiles being pictures no theme changes.
- docs/map.md: the Map view itself isn't covered by private locations (the
offline map style keeps it off the network).
- rules_editor: value_editor's doc comment back on it.
- pick_flow_tests: the bottom bar's focus order includes the Map view button.
From review on the Map view: pins could only be reached with the mouse. Each pin
or group on the canvas is now a focusable button (Tab), named for screen readers
("Photo pin", "Group of 3 photos, 1 selected"). With one focused, the arrow keys
move to the nearest pin that way, Return or Space selects its photos (Cmd/Ctrl+
Return adds them), a screen reader's Click selects them too, and its preview shows
as on hover (not under its open loupe). The other Map keys keep working: a focused
pin keeps only its arrows, Return and Space (canvas_keys::mark_focused). Pins a
cell past the canvas, and the repeated world copies of a pin, take no focus.
Also: the test for tiles evicted before they were drawn keeps one view and
redraws until loaded, as the map does, since tiles dropped from the arrival queue
are now looked for again on a later frame.
A custom source pointed at OpenStreetMap's own tile servers (tile.openstreetmap.org,
its a./b./c. names, any path, a trailing dot) is now the OpenStreetMap source
whatever its id, so it always shows OpenStreetMap's licence credit and asks at
most zoom 19; another credit or a higher zoom is refused. docs/map.md says so,
and says exactly which files clearing the tile cache deletes.
Resolves the 47 conflicts that blocked PR #4243:
- crates/ui-egui/locales/*.json (34 files): merged key by key against the
merge base; no key was changed differently on both sides; main's key
order, with this branch's new keys after their neighbours.
- crates/engine: Cargo.toml keeps main's jiff and this branch's chrono
note; Session keeps both sides' fields; print.rs takes main's template
folders and saves through this branch's save_prefs_or_undo; the test
module lists and persist.rs keep both sides' tests.
- crates/ui-egui: menubar.rs moves to main's submenu_items; icons,
shortcuts, the settings doc line and the test module lists keep both.
- docs: both sides' rows; the parity summary regenerated.
main's new menu and settings tests also required:
- The Map view's commands move from View > Map to Window > Map, below the
Map panel toggles: View is at main's 40-row limit (39.5 on main, 41.5 with
View > Map). Map View (Cmd+Alt+3) is there too; the registry's duplicates
(map.lock, map.filterBar, view.map, view.toggleMapFilter,
map.lockMarkers) are listed in HIDDEN. MENU-VIEW-MAP goes to partial.
- Photo no longer lists Edit Capture Time and Auto-Tag from Tracklog at
its top level: main moved them into Photo > Metadata.
- Settings > Map's button is "Delete Cached Tiles", so a settings search
for "Clear Cache" finds only the preview cache.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The ArcGIS key file is created owner-only (0600 on Unix) before the key is written
(safe_file::write_atomic_private), not chmod-ed after.
- A tile body has a 60 s deadline: a server trickling bytes no longer holds a network slot.
- locations.json with bad entries is never written back when its copy can't be made.
- Which photos' GPS is LightCraft's is kept in prefs.json (gpsOwned), so a position cleared
with automatic XMP writing off still leaves the sidecar after a reopen.
- Pins hidden by the Untagged filter can't be dragged (drawing and hit testing share one rule).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Keys in the Map view only (shortcuts::grid_key_command, the rule that
already gave the map \ and Cmd+K): H hides / shows the pins, O the saved
locations list, = / - and Cmd+= / Cmd+- zoom the map, Cmd+0 fits it; the +
alias zooms there too. Elsewhere the keys keep Remove, the mask overlay,
the grid's thumbnail size and the photo zoom; the Masking panel's H
override stays out of the Map view.
- Hide Pins: MapUi.show_pins (saved in ui.json), the bottom toolbar's Hide
Pins, map.showPins {on?}; hidden pins can't be clicked, hovered or dragged;
saved locations and the track log stay. map.showLocations {on?} (the
navigator panel holding the list), map.settings (Settings > Map).
- View > Map (after PR #921's map menu): Fit, Zoom In / Out, Map Pins, Lock
Markers, Location Filter Bar, Location Filter > 4 modes, Saved Locations >
New Location... / Saved Locations List, Tracklog > Load / Auto-Tag / Set
Offset / Fit / Clear, Map Tiles...; greyed outside the Map view. Window >
Map keeps the panel toggles.
- Settings > Map: the tile source (built-in sources usable now, the Esri
styles only with a key, Offline), a custom server applied on Apply or
Return only (a refused one shows why and changes nothing), the tile cache's
size with Clear Cache, what a tile server sees, a link to docs/map.md, then
the ArcGIS key. The offline note says "Map tiles are off (Settings > Map)".
- Tests: tests/map_keys.rs (each key in and out of the Map view, hidden pins
not clickable, the menu and its states, Settings source / bad server /
custom on Apply / Esri with a key).
- Docs: map.md "Keys and menus", library-shortcuts.md, control protocol;
LR-MAP-MODULE 0 -> partial, MENU-VIEW-MAP added; strings in all 17 catalogs.
After PR #921 by Jason Baldwin.
Co-Authored-By: Jason Baldwin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- crates/engine/src/map/track.rs (ported from PR #916): TrackShape projects a
track's segments once, cuts them at ±180°, ranks points for Douglas-Peucker
(ends kept, ~0.6 pt error), builds a level per zoom in chunks clipped to the
view. 2 million points (release): 370 ms to build, 1-29 ms per zoom level,
a frame's clipped lines under 1 ms (big_track_cost, ignored by default).
- crates/engine/src/tracklog.rs: map.trackLog (load path / gpx, active track,
camera time zone offset, clear; session only; 50 MB, 2 million timed
points; a refused file keeps the loaded log); photo.autoTagTracklog
{loaded: true} tags from the active track with its offset. Files are read
through read_file::read_regular under the byte cap (#3703's rule).
- The GPX parser's track indexes, names and caps already come from
craft-metadata.
- Map view (panels/map/tracks.rs): a Tracklog button in the bottom toolbar
with its menu (tracks, start / end / duration on the camera clock, Set Time
Zone Offset…, Auto-Tag N Selected Photos, Fit Map to Tracklog, Load
Another…, Clear); tracks drawn under the pins (others dimmed); the selected
photos marked where Auto-Tag puts them. Load Tracklog… reads the file on a
worker thread with an activity row ("Loading tracklog <file>") and fits the
map when it lands. UI commands map.loadTrackLog, map.trackLog.autoTag,
.setOffset, .fit; map.state.trackLog.
- The tile credit moves above the toolbar (the longer toolbar made it cover
Lock Markers) and the legend above the credit.
- Tests: engine tests/tracklog.rs and map/tests_track.rs (ported); UI
tests/map_tracks.rs (load and fit, track pick, ticks and auto-tag in one
undo step, bad files / hostile tracks / tiny window, the worker thread's
activity row).
- Docs: map.md "Track logs", control protocol, LRC-MAP-TRACKLOG row; strings
in all 17 catalogs.
Ported from PR #916 by Jason Baldwin.
Co-Authored-By: Jason Baldwin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- crates/engine/src/locations.rs (ported from PR #906): named circles, 1 m to
1000 km, great-circle (across ±180° and the poles), a private flag, checked
on every change; a latitude-sorted index for counts.
- Kept per library in locations.json (atomic; a damaged file or bad entries
set aside as locations.json.corrupt-<time> with a warning; a file that can't
be read is never overwritten). Older prefs.json savedLocations are written
there once, read back to confirm, and only then left out of prefs.json;
while unconfirmed (or with locations.json damaged) prefs.json keeps them.
- Commands map.locations, map.location.add (or fromSelection), .update,
.remove, .photos; app: map.location.show, .select, .new. The older
map.savedLocations.list/create/delete stay as aliases (numeric ids now).
- Private locations: photos inside them export without GPS or place fields
(the export's remove-location switch, per photo); the Info panel hides their
map until Show Map.
- Map view (panels/map/locations.rs): every location in view drawn with its
name; the active one has centre and radius handles (Lock Markers keeps
them); the navigator list shows counts of photos in view, a checkbox
selecting them, Go To, Rename…, Private, Delete… with a confirmation; +
around the selected photos or at the map's centre.
- GPS Radius smart-rule field (catalog, from #906), with its editor.
- Tests: engine tests/saved_locations.rs (ported, plus migration: old prefs
only, both files, a damaged locations.json); the private-export test fails
with the strip turned off; ported catalog circle tests; UI
tests/map_locations.rs.
- Docs: map.md "Saved locations", control protocol, LRC-MAP-LOCATIONS row;
strings in all 17 catalogs.
Ported from PR #906 by Jason Baldwin.
Co-Authored-By: Jason Baldwin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Smart-rule fields (crates/catalog/src/rules.rs): GPS Area (gpsArea, is
inside / is outside {south, west, north, east}; east < west wraps across
±180°; edges inside; no position is neither) and Has GPS counting only a
valid position. library.filter, album.createSmart and album.setRules refuse
missing edges, text, NaN, out-of-range values and south north of north;
album.ruleFields reports kind "area"; the rule editor shows four numbers and
never rewrites a stored out-of-range edge.
- Session::narrow: a view's own rules over source, filter and sort, never
saved or shown as the filter; visible_base_shared gives the list before it.
- The Map view's bar counts Visible on Map, Tagged, Untagged and None, and
narrows the filmstrip, selection and keys while the Map view is shown;
leaving it restores exactly the grid's list (sync_location_filter, every
frame). Visible on Map follows the view once it rests 250 ms (commands at
once). Pins come from the list before it; Untagged hides them with a note.
- map.locationFilter {mode?} → {mode, visible, tagged, untagged, all, area,
countMs, shown}; map.state.locationFilter.
- Tests: the ported catalog rule tests (areas, antimeridian, checks, Has GPS
on corrupt positions, smart albums following tagging), engine
tests/location.rs (library.filter, smart albums, narrowing over the filter,
empty library, 50,000 photos narrowed in 9 ms release, 20,000 counted in
0.1 ms), UI tests/map_filter.rs.
- Docs: map.md "Location filter", control protocol, LRC-MAP-FILTER row; 11
strings in all 17 catalogs.
Ported from PR #819 by Jason Baldwin.
Co-Authored-By: Jason Baldwin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Under the location fields: the fields' width, 160 pt, zoom 14 (or the
source's max), the photo's pin (kept on the map near the poles) and the tile
credit. The active photo's place with several selected; no map without a
valid position. A click opens the Map view centred there.
- Show on Map becomes Open in Browser (same widget id, still openstreetmap.org).
- It draws with the Map view's tile service and textures (tiles::draw, ring 0)
and only while on screen: with the Info panel closed or the map below the
panel's fold, nothing is wanted, so nothing is fetched for it. Offline: grey,
the pin, "Map tiles are off" (now at the top of a short map).
- The tile texture store moves from a process-wide static into the egui
context's memory, so each window (and each headless test) has its own;
parallel tests no longer roll each other's wanted tiles.
- map.state reports miniMap {photo, lat, lon, zoom, rect, pin, tiles};
widgets info:miniMap, info:miniMapAttribution.
- Tests (tests/map_info.rs, fake tile server): pin and credit, active photo
with several selected, no GPS, near the pole, a click to the Map view with
no tile fetched twice, nothing wanted off screen or below the fold, offline,
and keep_on_map on tiny and non-finite input.
- Docs: map.md "Info panel map", control protocol, LR-MAP-INFO ✅; two strings
in all 17 catalogs.
Ported in spirit from PR #804 by Jason Baldwin.
Co-Authored-By: Jason Baldwin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Phase 2 of the map work, and the Map view half of the geotag work (pin moves,
the lock and the pin menu share the canvas's input handling, so they came
with the rewrite):
- Clustering moves to the engine (map/cluster.rs, ported from PR #797):
positions are projected once per change of the photo list, then grouped in
world-anchored ~60 pt cells, so panning never regroups the pins and zooming
in only splits them. 50,000 photos cluster in 1.7 ms (release).
- The view uses the engine's Viewport for pan, wheel zoom and positions.
Fit to Photos (toolbar, map.fit, and the first showing in a session),
map.setView {lat?, lon?, zoom?} (hostile values refused), map.zoomIn /
map.zoomOut. "N photos without GPS" on the map; hovering a pin shows its
photo's thumbnail; double-click opens Detail or zooms into a cluster.
- A drag that starts on a single photo's pin moves it (photo.setGps, one undo
step; let go off the map, nothing changes); a cluster's drag pans. Lock
Markers (toolbar, map.lockMarkers {on?}, Cmd/Ctrl+K in the Map view, saved
in ui.json) stops pin moves. A pin's right-click menu removes its photos'
GPS (photo.removeGps); Photo > Remove GPS Coordinates in the menu bar.
- map.state gains maxZoom, source, offline, attribution, pins' lat/lon,
clusterCount, clusterMs, withGps/withoutGps, lockMarkers, movingPin, hovered.
- Tests: tests/map_geotag.rs (pin move and undo, cluster pans, Lock Markers,
pin menu and Photo menu, groups kept on pan and split on zoom, view
commands and hostile values, first-showing fit, without-GPS count, hover
thumbnail, empty library) and the ported engine cluster tests.
- Docs: map.md (Map view, Geotagging, commands), control protocol, parity
rows (LRC-MAP-GEOTAG ✅, MENU-PHOTO-REMOVEGPS), gaps; strings in all 17
catalogs.
Ported in part from PRs #797 and #810 by Jason Baldwin.
Co-Authored-By: Jason Baldwin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Esri Streets and Esri Outdoor (topographic) come from the ArcGIS Location
Platform static basemap tiles service with the user's key (Settings > Map,
map.setEsriKey); without a key they are not offered and map.tileSource
refuses them, saying where to get one. The keyless arcgisonline endpoints
are gone; World Imagery is dropped (no raster imagery style there).
- Esri's 512 px tiles are cut into the four 256 px tiles they hold; one
request serves all four.
- The key is a secret: kept in the config folder (map-keys.json, 0600 on
Unix), never journaled, logged, reported (esriKeySet only), used as a cache
key or shown in errors ([key]); ApiKey's Debug hides it.
- The map's credit is "Powered by Esri" plus the style's copyrightText from
its metadata (bounded, plain text), else a fixed fallback.
- docs/map.md records the endpoints, what was read and what could not be
verified (attribution guide, platform agreement).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Map view had no filmstrip: only Detail and Compare draw it, and in the Map view the
bottom bar fell into the grid branch, showing a thumbnail-size slider that did nothing
and no filmstrip toggle. So photos could not be dragged onto the map, and the map did not
show which photos were selected beyond a pin colour.
- The Map view draws the shared filmstrip under the map when it is on (View > Filmstrip,
`/`, F6), as Detail does, and shrinks the map above it (not in full screen, not when the
window is too short). In the Map view the bottom bar shows the Filmstrip toggle instead
of the thumbnail size.
- Photos carried from the filmstrip (the drag the filmstrip and grid already start: the
selection, or the photo alone when it is not selected) draw a pin with their count at
the pointer over the map, and the drag label says "Set the location of N photos". A
release over the map gives all of them that point's position, overwriting one they had,
as one undo step (`photo.setGps`). A release over the map's toolbar or filter bar, or
outside the map, changes nothing. The longitude wraps around the world and the latitude
stays inside Web Mercator's 85.05 degrees.
- Selection both ways: a cluster holding selected photos is yellow and carries a bubble
with how many are selected; a click on a pin selects its photo and a click on a cluster
selects all its photos (the first active; Cmd/Ctrl adds), so the filmstrip shows them
and scrolls to the active one. Pins are not hovered or clicked while photos are carried.
- `map.state` (UI command) reports the view, the canvas, whether the filmstrip is drawn,
each pin drawn last frame with its ids, count and selected count, and a drop in
progress; it is cleared each frame so it reports nothing once the map is gone.
- `photo.setGps` is extended rather than duplicated: it names its photos explicitly,
wraps the longitude into -180..180 (it refused 190), refuses ids the library doesn't
have (it skipped them silently, so a drop of photos deleted meanwhile reported success),
and its undo step and label are "Set GPS Coordinates"; it now also returns lat/lon.
This validation follows PR #810 (geotag); the drop itself is written for this branch's
map view, since #810 builds on #797's cluster and viewport code.
New strings are in every locale catalog. docs/map.md gains "Map view" and "Geotagging"
sections; control-protocol, the LRC-MAP-VIEW and LRC-MAP-GEOTAG rows (geotag stays
partial: no pin move, Lock Markers, Remove GPS menu or sidecar fix yet) and gap 16 are
updated.
Tests: new `ui-egui tests::map_filmstrip` (filmstrip drawn and toggled in the Map view,
bottom bar toggle and no slider; filmstrip drag sets GPS for two photos in one undo
step; a drop on the toolbar or of missing photos changes nothing; selected counts per
pin and a cluster click selecting in the filmstrip) and two engine tests (one undo step
and restore for several photos; longitude wrap and hostile values). Each failed with its
change reverted (filmstrip not drawn; bottom bar branch, drop handler and cluster
selection disabled; old `photo.setGps`). `cargo xtask ci --quick` (fmt, clippy, tests of
every package): all pass except the known failures on this machine (13 lightcraft-raw
corpus tests, 2 engine corpus tests; the GPU out-of-memory test failed in one run and
passed in the other, and ui-egui find_similar::stopping_leaves_the_view_alone... failed
once and passed three times alone). `cargo xtask layers`, `assets`, `roots`, `parity`
and `wasm` pass. The app was run with `--demo --control 18421` and a headless snapshot:
filmstrip under the map, a drag from it dropped two photos at the pointer, selected
counts on the clusters, a cluster click selecting its photos in the filmstrip.
Co-Authored-By: Jason Baldwin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Map view fetched tiles from its own pool of six threads with no cache policy, no
backoff and two User-Agent headers, and offered Esri's ArcGIS tiles by default. The tile
core of PR #797 is ported into the engine (crates/engine/src/map/: mercator, source,
cache, service; no new crate) and the view now draws from it:
- Tile sources are a library preference (prefs.json mapSource, `map.tileSource`):
OpenStreetMap (default), OpenTopoMap, a checked https custom template, or Offline (no
service, no threads). `map.providers` lists the sources offered; `map.cacheInfo` and
`map.clearCache` report and empty the disk cache.
- Fetching follows the OSM tile usage policy: only the tiles in view plus one ring,
newest view first with stale requests dropped, at most two requests in flight,
exponential backoff on errors/429/5xx honouring Retry-After, one distinct
`LightCraft/<version> (+https://github.com/storytold/lightcraft)` User-Agent (fetch's
`get` no longer adds a second one), no no-cache, size/content/decode checks. One
"Loading map tiles" activity row while tiles are queued.
- Disk cache in the per-user cache folder (`<cache>/maptiles`, new `config::cache_dir`),
one folder per source: Cache-Control/Expires/ETag with conditional refresh (7 days by
default), 500 MB LRU cap, atomic writes, damaged entries refetched. HTTP dates go
through chrono.
- Sessions fetch only when the host asks (`with_default_map_cache`: desktop app, CLI
snapshot, MCP), so tests never go online; the test that hit Esri's server is gone.
- UI: one texture cache (256, LRU) for the map and the navigator; a missing tile is drawn
from a loaded ancestor up to four zooms up; the service gets the union of the tiles
drawn this frame and the last, and nothing once no map is drawn. The credit is always
painted bottom right.
- `LatLon::new` rejects out-of-range positions instead of clamping them (95° was accepted
as the pole); `LatLon::wrapped` wraps longitude.
- Esri: their terms (docs/map.md, with URLs) allow the layers only with Esri software or
an ArcGIS subscription, so they are not offered, `map.tileSource` refuses them, and a
library saved with one opens on OpenStreetMap with a one-line notice while prefs.json
keeps the choice. No command turns them on; that needs a maintainer decision.
docs/map.md is new; control-protocol, the LRC-MAP-VIEW row and gap 16 are updated.
Tests: `cargo xtask ci --quick` (fmt, clippy, tests of every package): all map, fetch,
geom, config and UI tests pass; the only failures are the pre-existing ones on this
machine (13 lightcraft-raw corpus tests, 2 engine corpus tests, 1 GPU out-of-memory
test). `cargo xtask layers`, `assets`, `roots`, `parity` and `wasm` pass. The app was run
with `--demo --control 18421` and screenshotted: OSM tiles load in the map and the
navigator with the credit, Esri is refused, Offline shows the grey map.
Co-Authored-By: Jason Baldwin <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>