Show the Markers layer when a location is created or focused
Points placed with Draw > Point were written to the database but never appeared on the map. The cause is not in the new workflow: the Markers layer is built with visible: false so a fresh map is uncluttered, and nothing in the application ever switched it on — only the LayerSwitcher could. So the record was saved, the map panned to it, and nothing was drawn. This predates the workflow change; making Draw > Point the single way to add a point is what made it obvious, because placing a point is now the common gesture rather than an occasional one. MapView.showMarkers() switches the layer on, and the three places that act on a specific location call it: adding one from the map form, adding one from the sidebar form, and picking one from the Locations list. The default stays hidden, so a map with no locations in play still opens clean. Traced the marker count and layer visibility through the whole sequence — add, enter Digitise, draw, save, pick Select, leave Digitise. The count was always right and the layer was false throughout, which is what pinned the cause; it is now true from the save onward. Service Worker v20 -> v21. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
b28a34bc38
commit
f92a3d43c1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
dist/assets/index-BQfxXCp7.js.map
vendored
Normal file
1
dist/assets/index-BQfxXCp7.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/assets/index-CF9fisV-.js.map
vendored
1
dist/assets/index-CF9fisV-.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/index.html
vendored
2
dist/index.html
vendored
@ -1917,7 +1917,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script type="module" crossorigin src="/assets/index-CF9fisV-.js"></script>
|
<script type="module" crossorigin src="/assets/index-BQfxXCp7.js"></script>
|
||||||
<link rel="modulepreload" crossorigin href="/assets/openlayers-J9qS6Th1.js">
|
<link rel="modulepreload" crossorigin href="/assets/openlayers-J9qS6Th1.js">
|
||||||
<link rel="modulepreload" crossorigin href="/assets/pako-Xa-UToif.js">
|
<link rel="modulepreload" crossorigin href="/assets/pako-Xa-UToif.js">
|
||||||
<link rel="modulepreload" crossorigin href="/assets/geotiff-BaoeLn6q.js">
|
<link rel="modulepreload" crossorigin href="/assets/geotiff-BaoeLn6q.js">
|
||||||
|
|||||||
7
dist/sw.js
vendored
7
dist/sw.js
vendored
@ -113,7 +113,12 @@
|
|||||||
// add/remove pair is kept off the undo stack. Marker details, which used
|
// add/remove pair is kept off the undo stack. Marker details, which used
|
||||||
// to need Add Location mode, now open in the neutral mode. The dock keeps
|
// to need Add Location mode, now open in the neutral mode. The dock keeps
|
||||||
// its six remaining buttons and divides them evenly on narrow screens.
|
// its six remaining buttons and divides them evenly on narrow screens.
|
||||||
const CACHE_VERSION = 'v20';
|
// v21: Location markers were saved but never drawn. The Markers layer is built
|
||||||
|
// hidden and nothing ever switched it on except the LayerSwitcher, so a
|
||||||
|
// point placed with Draw > Point was written to the database and the map
|
||||||
|
// panned to it with nothing to see. Creating a location, or picking one
|
||||||
|
// from the Locations list, now switches the layer on.
|
||||||
|
const CACHE_VERSION = 'v21';
|
||||||
const SHELL_CACHE = `shell-${CACHE_VERSION}`;
|
const SHELL_CACHE = `shell-${CACHE_VERSION}`;
|
||||||
const MODULES_CACHE = `modules-${CACHE_VERSION}`;
|
const MODULES_CACHE = `modules-${CACHE_VERSION}`;
|
||||||
const API_CACHE = `api-${CACHE_VERSION}`;
|
const API_CACHE = `api-${CACHE_VERSION}`;
|
||||||
|
|||||||
8
main.js
8
main.js
@ -397,6 +397,10 @@ async function initApp() {
|
|||||||
|
|
||||||
await loadLocations();
|
await loadLocations();
|
||||||
|
|
||||||
|
// The Markers layer starts hidden, so without this the point the officer
|
||||||
|
// just placed is written to the database and never drawn.
|
||||||
|
mapView?.showMarkers();
|
||||||
|
|
||||||
// Zoom to the new location on the map
|
// Zoom to the new location on the map
|
||||||
mapView?.zoomTo(data.lon, data.lat, 14);
|
mapView?.zoomTo(data.lon, data.lat, 14);
|
||||||
|
|
||||||
@ -849,6 +853,9 @@ async function handleAddLocation(event) {
|
|||||||
form.reset();
|
form.reset();
|
||||||
await loadLocations();
|
await loadLocations();
|
||||||
|
|
||||||
|
// As above: the Markers layer is hidden until something needs it shown.
|
||||||
|
mapView?.showMarkers();
|
||||||
|
|
||||||
// Zoom to the new location on the map
|
// Zoom to the new location on the map
|
||||||
mapView?.zoomTo(longitude, latitude, 14);
|
mapView?.zoomTo(longitude, latitude, 14);
|
||||||
|
|
||||||
@ -968,6 +975,7 @@ function renderLocations(locations) {
|
|||||||
const id = parseInt(item.dataset.id);
|
const id = parseInt(item.dataset.id);
|
||||||
|
|
||||||
// Zoom to location on map
|
// Zoom to location on map
|
||||||
|
mapView?.showMarkers();
|
||||||
mapView?.zoomTo(lon, lat, 14);
|
mapView?.zoomTo(lon, lat, 14);
|
||||||
|
|
||||||
// Select the marker
|
// Select the marker
|
||||||
|
|||||||
@ -113,7 +113,12 @@
|
|||||||
// add/remove pair is kept off the undo stack. Marker details, which used
|
// add/remove pair is kept off the undo stack. Marker details, which used
|
||||||
// to need Add Location mode, now open in the neutral mode. The dock keeps
|
// to need Add Location mode, now open in the neutral mode. The dock keeps
|
||||||
// its six remaining buttons and divides them evenly on narrow screens.
|
// its six remaining buttons and divides them evenly on narrow screens.
|
||||||
const CACHE_VERSION = 'v20';
|
// v21: Location markers were saved but never drawn. The Markers layer is built
|
||||||
|
// hidden and nothing ever switched it on except the LayerSwitcher, so a
|
||||||
|
// point placed with Draw > Point was written to the database and the map
|
||||||
|
// panned to it with nothing to see. Creating a location, or picking one
|
||||||
|
// from the Locations list, now switches the layer on.
|
||||||
|
const CACHE_VERSION = 'v21';
|
||||||
const SHELL_CACHE = `shell-${CACHE_VERSION}`;
|
const SHELL_CACHE = `shell-${CACHE_VERSION}`;
|
||||||
const MODULES_CACHE = `modules-${CACHE_VERSION}`;
|
const MODULES_CACHE = `modules-${CACHE_VERSION}`;
|
||||||
const API_CACHE = `api-${CACHE_VERSION}`;
|
const API_CACHE = `api-${CACHE_VERSION}`;
|
||||||
|
|||||||
@ -3584,6 +3584,23 @@ export class MapView {
|
|||||||
/**
|
/**
|
||||||
* Select a marker (highlights it)
|
* Select a marker (highlights it)
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* Make the Markers layer visible.
|
||||||
|
*
|
||||||
|
* The layer starts hidden so a fresh map is uncluttered, and the LayerSwitcher
|
||||||
|
* is the only thing that ever turned it on. That is fine until the officer
|
||||||
|
* creates or focuses a location, at which point an invisible layer means the
|
||||||
|
* point they just placed is simply not there — the record is written, the map
|
||||||
|
* pans to it, and nothing is drawn. Callers that act on a specific location
|
||||||
|
* call this so the result of the action can actually be seen.
|
||||||
|
*/
|
||||||
|
showMarkers() {
|
||||||
|
if (this.markersLayer && !this.markersLayer.getVisible()) {
|
||||||
|
this.markersLayer.setVisible(true);
|
||||||
|
console.log('[MapView] Markers layer switched on to show a location');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
selectMarker(featureOrId) {
|
selectMarker(featureOrId) {
|
||||||
if (typeof featureOrId === 'object') {
|
if (typeof featureOrId === 'object') {
|
||||||
this.selectedFeature = featureOrId;
|
this.selectedFeature = featureOrId;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user