@abi-software/flatmap-viewer 2.4.1-b.4 → 2.4.2-b.1
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 +1 -1
- package/package.json +1 -1
- package/src/flatmap-viewer.js +3 -2
- package/src/interactions.js +3 -4
- package/src/main.js +1 -0
- package/src/utils.js +9 -5
- package/static/css/flatmap-viewer.css +0 -6
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.
|
|
41
|
+
* ``npm install @abi-software/flatmap-viewer@2.4.2-b.1``
|
|
42
42
|
|
|
43
43
|
Documentation
|
|
44
44
|
-------------
|
package/package.json
CHANGED
package/src/flatmap-viewer.js
CHANGED
|
@@ -545,11 +545,12 @@ class FlatMap
|
|
|
545
545
|
__updateFeatureIdMapEntry(propertyId, featureIdMap, featureId)
|
|
546
546
|
//============================================================
|
|
547
547
|
{
|
|
548
|
-
const
|
|
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(
|
|
553
|
+
featureIdMap.set(id, [featureId]);
|
|
553
554
|
}
|
|
554
555
|
}
|
|
555
556
|
|
package/src/interactions.js
CHANGED
|
@@ -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({
|
|
1228
|
+
const marker = new maplibregl.Marker({element: markerElement})
|
|
1230
1229
|
.setLngLat(markerPosition)
|
|
1231
1230
|
.addTo(this._map);
|
|
1232
1231
|
markerElement.addEventListener('mouseenter',
|
package/src/main.js
CHANGED
package/src/utils.js
CHANGED
|
@@ -22,7 +22,11 @@ limitations under the License.
|
|
|
22
22
|
|
|
23
23
|
//==============================================================================
|
|
24
24
|
|
|
25
|
-
|
|
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 (
|
|
109
|
-
|
|
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
|
-
|
|
112
|
-
return parts.join(':');
|
|
116
|
+
return id;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
//==============================================================================
|