@abi-software/flatmap-viewer 2.3.2-b.2 → 2.3.2-b.4

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/README.rst CHANGED
@@ -38,7 +38,7 @@ The map server endpoint is specified as ``MAP_ENDPOINT`` in ``src/main.js``. It
38
38
  Package Installation
39
39
  ====================
40
40
 
41
- * ``npm install @abi-software/flatmap-viewer@2.3.2-b.2``
41
+ * ``npm install @abi-software/flatmap-viewer@2.3.2-b.4``
42
42
 
43
43
  Documentation
44
44
  -------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmap-viewer",
3
- "version": "2.3.2-b.2",
3
+ "version": "2.3.2-b.4",
4
4
  "description": "Flatmap viewer using Maplibre GL",
5
5
  "repository": "https://github.com/AnatomicMaps/flatmap-viewer.git",
6
6
  "main": "src/main.js",
@@ -146,6 +146,9 @@ export class UserInteractions
146
146
  for (const path of mapPathTypes) {
147
147
  this.__pathManager.enablePathsByType(path.type, path.enabled, true);
148
148
  }
149
+ if (this.__pathManager.haveCentrelines) {
150
+ this.enableCentrelines(this.__pathManager.enabledCentrelines, true);
151
+ }
149
152
 
150
153
  // Add annotation capability
151
154
  if (flatmap.options.annotator) {
@@ -180,7 +183,6 @@ export class UserInteractions
180
183
  // Add a control for nerve centrelines if they are present
181
184
  if (this.__pathManager.haveCentrelines) {
182
185
  this._map.addControl(new NerveControl(flatmap, this._layerManager, {showCentrelines: false}));
183
- this.enableCentrelines(false, true);
184
186
  }
185
187
 
186
188
  // SCKAN path and SYSTEMS controls for FC maps
@@ -330,9 +332,14 @@ export class UserInteractions
330
332
  //====================================
331
333
  {
332
334
  if (feature !== undefined) {
333
- if (enable) {
334
- this._map.removeFeatureState(feature, 'hidden');
335
- } else {
335
+ const state = this._map.getFeatureState(feature);
336
+ if ('hidden' in state) {
337
+ if (enable) {
338
+ this._map.removeFeatureState(feature, 'hidden');
339
+ } else if (!state.hidden) {
340
+ this._map.setFeatureState(feature, { 'hidden': true });
341
+ }
342
+ } else if (!enable) {
336
343
  this._map.setFeatureState(feature, { 'hidden': true });
337
344
  }
338
345
  this.__enableFeatureMarker(feature.id, enable);
package/src/pathways.js CHANGED
@@ -126,6 +126,7 @@ export class PathManager
126
126
 
127
127
  // Nerve centrelines are a special case with their own controls
128
128
  this.__haveCentrelines = false;
129
+ this.__enabledCentrelines = false;
129
130
  }
130
131
 
131
132
  get haveCentrelines()
@@ -134,6 +135,12 @@ export class PathManager
134
135
  return this.__haveCentrelines;
135
136
  }
136
137
 
138
+ get enabledCentrelines()
139
+ //======================
140
+ {
141
+ return this.__enabledCentrelines;
142
+ }
143
+
137
144
  __assignPathTypes()
138
145
  //=================
139
146
  {
@@ -153,6 +160,7 @@ export class PathManager
153
160
  && this.__pathsByType[pathTypeDefn.type].length > 0) {
154
161
  if (pathTypeDefn.type === 'centreline') {
155
162
  this.__haveCentrelines = true;
163
+ this.__enabledCentrelines = this.__pathtypeEnabled[pathTypeDefn.type];
156
164
  } else {
157
165
  pathTypes.push({
158
166
  ...pathTypeDefn,