@abi-software/flatmap-viewer 2.4.1-b.4 → 2.4.1-b.5

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.4.1-b.4``
41
+ * ``npm install @abi-software/flatmap-viewer@2.4.1-b.5``
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.4.1-b.4",
3
+ "version": "2.4.1-b.5",
4
4
  "description": "Flatmap viewer using Maplibre GL",
5
5
  "repository": "https://github.com/AnatomicMaps/flatmap-viewer.git",
6
6
  "main": "src/main.js",
@@ -545,11 +545,12 @@ class FlatMap
545
545
  __updateFeatureIdMapEntry(propertyId, featureIdMap, featureId)
546
546
  //============================================================
547
547
  {
548
- const featureIds = featureIdMap.get(propertyId);
548
+ const id = utils.normaliseId(propertyId)
549
+ const featureIds = featureIdMap.get(id);
549
550
  if (featureIds) {
550
551
  featureIds.push(featureId);
551
552
  } else {
552
- featureIdMap.set(propertyId, [featureId]);
553
+ featureIdMap.set(id, [featureId]);
553
554
  }
554
555
  }
555
556
 
@@ -1202,7 +1202,7 @@ export class UserInteractions
1202
1202
 
1203
1203
  for (const featureId of featureIds) {
1204
1204
  const annotation = this._flatmap.annotation(featureId);
1205
- if (!annotation.geometry.includes('Polygon')) {
1205
+ if (!('markerPosition' in annotation) && !annotation.geometry.includes('Polygon')) {
1206
1206
  continue;
1207
1207
  }
1208
1208
  if (!('marker' in annotation)) {
@@ -1216,17 +1216,16 @@ export class UserInteractions
1216
1216
  // inside the marker container <div>.
1217
1217
  const colour = options.colour || '#005974';
1218
1218
  const markerHTML = options.element ? new maplibregl.Marker({element: options.element})
1219
- : new maplibregl.Marker({color: colour});
1219
+ : new maplibregl.Marker({color: colour, scale: 0.5});
1220
1220
 
1221
1221
  const markerElement = document.createElement('div');
1222
1222
  const markerIcon = document.createElement('div');
1223
1223
  markerIcon.innerHTML = markerHTML.getElement().innerHTML;
1224
- markerIcon.className = 'flatmap-marker';
1225
1224
  markerElement.id = `marker-${markerId}`;
1226
1225
  markerElement.appendChild(markerIcon);
1227
1226
 
1228
1227
  const markerPosition = this.__markerPosition(featureId, annotation);
1229
- const marker = new maplibregl.Marker({marker: markerElement})
1228
+ const marker = new maplibregl.Marker({element: markerElement})
1230
1229
  .setLngLat(markerPosition)
1231
1230
  .addTo(this._map);
1232
1231
  markerElement.addEventListener('mouseenter',
package/src/utils.js CHANGED
@@ -22,7 +22,11 @@ limitations under the License.
22
22
 
23
23
  //==============================================================================
24
24
 
25
- const NO_NORMALISATION = ['http', 'https', 'urn', 'NCBITaxon'];
25
+ // A PMID is a "1- to 8-digit accession number with no leading zeros"
26
+ const ZERO_PAD_PREFIXES = {
27
+ 'ILX': 7,
28
+ 'UBERON': 7
29
+ };
26
30
 
27
31
  //==============================================================================
28
32
 
@@ -105,11 +109,11 @@ export function normaliseId(id)
105
109
  }
106
110
  const parts = id.split(':')
107
111
  const lastPart = parts[parts.length - 1]
108
- if (NO_NORMALISATION.includes(parts[0]) || !'0123456789'.includes(lastPart[0])) {
109
- return id;
112
+ if (parts[0].toUpperCase() in ZERO_PAD_PREFIXES && '0123456789'.includes(lastPart[0])) {
113
+ parts[parts.length - 1] = lastPart.padStart(ZERO_PAD_PREFIXES[parts[0].toUpperCase()], '0');
114
+ return parts.join(':');
110
115
  }
111
- parts[parts.length - 1] = lastPart.padStart(8, '0');
112
- return parts.join(':');
116
+ return id;
113
117
  }
114
118
 
115
119
  //==============================================================================
@@ -230,12 +230,6 @@ label[for=layer-all-layers] {
230
230
  font-weight: bold;
231
231
  }
232
232
 
233
- /* Markers */
234
-
235
- .flatmap-marker {
236
- transform: scale(0.5);
237
- }
238
-
239
233
  /* Annotator */
240
234
  .flex-auto {
241
235
  flex: 1 1 auto;