@abi-software/flatmap-viewer 2.2.1-beta.5 → 2.2.1-beta.6
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 +2 -1
- package/src/interactions.js +29 -8
- package/src/styling.js +4 -2
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.2.1-beta.
|
|
41
|
+
* ``npm install @abi-software/flatmap-viewer@2.2.1-beta.6``
|
|
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.2.1-beta.
|
|
3
|
+
"version": "2.2.1-beta.6",
|
|
4
4
|
"description": "Flatmap viewer using Maplibre GL",
|
|
5
5
|
"repository": "https://github.com/AnatomicMaps/flatmap-viewer.git",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@turf/area": "^6.0.1",
|
|
22
22
|
"@turf/bbox": "^6.0.1",
|
|
23
23
|
"@turf/helpers": "^6.1.4",
|
|
24
|
+
"bezier-js": "^6.1.0",
|
|
24
25
|
"maplibre-gl": ">=1.15.3",
|
|
25
26
|
"minisearch": "^2.2.1",
|
|
26
27
|
"polylabel": "^1.1.0"
|
package/src/interactions.js
CHANGED
|
@@ -631,6 +631,26 @@ export class UserInteractions
|
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
633
|
|
|
634
|
+
lineTooltip_(lineFeatures)
|
|
635
|
+
//========================
|
|
636
|
+
{
|
|
637
|
+
const tooltips = [];
|
|
638
|
+
for (const lineFeature of lineFeatures) {
|
|
639
|
+
const properties = lineFeature.properties;
|
|
640
|
+
if ('label' in properties
|
|
641
|
+
&& (!('tooltip' in properties) || properties.tooltip)
|
|
642
|
+
&& !('labelled' in properties)) {
|
|
643
|
+
let tooltip = '';
|
|
644
|
+
const label = properties.label;
|
|
645
|
+
tooltips.push((label.substr(0, 1).toUpperCase() + label.substr(1)).replaceAll("\n", "<br/>"));
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
if (tooltips.length === 0) {
|
|
649
|
+
return '';
|
|
650
|
+
}
|
|
651
|
+
return tooltips.join('<hr/>');
|
|
652
|
+
}
|
|
653
|
+
|
|
634
654
|
tooltipHtml_(properties, forceLabel=false)
|
|
635
655
|
//========================================
|
|
636
656
|
{
|
|
@@ -731,14 +751,15 @@ export class UserInteractions
|
|
|
731
751
|
&& feature.properties.type.startsWith('line'))
|
|
732
752
|
|| 'centreline' in feature.properties));
|
|
733
753
|
if (lineFeatures.length > 0) {
|
|
734
|
-
|
|
735
|
-
const
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
754
|
+
tooltip = this.lineTooltip_(lineFeatures);
|
|
755
|
+
for (const lineFeature of lineFeatures) {
|
|
756
|
+
const lineFeatureId = +lineFeature.properties.featureId; // Ensure numeric
|
|
757
|
+
this.activateFeature_(lineFeature);
|
|
758
|
+
const lineIds = new Set(lineFeatures.map(f => f.properties.featureId));
|
|
759
|
+
for (const featureId of this._pathways.lineFeatureIds(lineIds)) {
|
|
760
|
+
if (+featureId !== lineFeatureId) {
|
|
761
|
+
this.activateFeature_(this.mapFeature_(featureId));
|
|
762
|
+
}
|
|
742
763
|
}
|
|
743
764
|
}
|
|
744
765
|
} else {
|
package/src/styling.js
CHANGED
|
@@ -117,9 +117,9 @@ export class FeatureFillLayer extends VectorStyleLayer
|
|
|
117
117
|
const paintStyle = {
|
|
118
118
|
'fill-color': [
|
|
119
119
|
'case',
|
|
120
|
+
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
120
121
|
['has', 'colour'], ['get', 'colour'],
|
|
121
122
|
['boolean', ['feature-state', 'active'], false], coloured ? '#D88' : '#CCC',
|
|
122
|
-
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
123
123
|
['any',
|
|
124
124
|
['==', ['get', 'kind'], 'scaffold']
|
|
125
125
|
], 'white',
|
|
@@ -260,15 +260,16 @@ export class FeatureLineLayer extends VectorStyleLayer
|
|
|
260
260
|
const paintStyle = {
|
|
261
261
|
'line-color': [
|
|
262
262
|
'case',
|
|
263
|
+
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
263
264
|
['has', 'colour'], ['get', 'colour'],
|
|
264
265
|
['boolean', ['feature-state', 'active'], false], coloured ? '#D88' : '#CCC',
|
|
265
|
-
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
266
266
|
['==', ['get', 'type'], 'network'], '#AFA202',
|
|
267
267
|
['has', 'centreline'], '#888',
|
|
268
268
|
('style' in options && options.style === 'authoring') ? '#C44' : '#444'
|
|
269
269
|
],
|
|
270
270
|
'line-opacity': [
|
|
271
271
|
'case',
|
|
272
|
+
['boolean', ['feature-state', 'selected'], false], 1.0,
|
|
272
273
|
['boolean', ['feature-state', 'active'], false], 1.0,
|
|
273
274
|
0.3
|
|
274
275
|
],
|
|
@@ -278,6 +279,7 @@ export class FeatureLineLayer extends VectorStyleLayer
|
|
|
278
279
|
'case',
|
|
279
280
|
['has', 'centreline'], 1.2,
|
|
280
281
|
['==', ['get', 'type'], 'network'], 1.2,
|
|
282
|
+
['boolean', ['feature-state', 'selected'], false], 1.2,
|
|
281
283
|
['boolean', ['feature-state', 'active'], false], 1.2,
|
|
282
284
|
('style' in options && options.style === 'authoring') ? 0.7 : 0.5
|
|
283
285
|
], [
|