@abi-software/flatmap-viewer 2.2.10-devel.1 → 2.2.10
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/package.json +1 -1
- package/src/controls.js +8 -8
- package/src/flatmap-viewer.js +12 -15
- package/src/interactions.js +11 -5
- package/src/layers.js +39 -22
- package/src/main.js +4 -2
- package/src/pathways.js +16 -0
- package/src/styling.js +29 -30
- package/src/utils.js +1 -1
package/package.json
CHANGED
package/src/controls.js
CHANGED
|
@@ -22,7 +22,6 @@ limitations under the License.
|
|
|
22
22
|
|
|
23
23
|
//==============================================================================
|
|
24
24
|
|
|
25
|
-
import * as pathways from './pathways.js';
|
|
26
25
|
|
|
27
26
|
//==============================================================================
|
|
28
27
|
|
|
@@ -91,10 +90,11 @@ export class NavigationControl
|
|
|
91
90
|
|
|
92
91
|
export class PathControl
|
|
93
92
|
{
|
|
94
|
-
constructor(flatmap)
|
|
93
|
+
constructor(flatmap, pathTypes)
|
|
95
94
|
{
|
|
96
95
|
this._flatmap = flatmap;
|
|
97
96
|
this._map = undefined;
|
|
97
|
+
this.__pathTypes = pathTypes;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
getDefaultPosition()
|
|
@@ -117,11 +117,11 @@ export class PathControl
|
|
|
117
117
|
|
|
118
118
|
const innerHTML = [];
|
|
119
119
|
innerHTML.push(`<label for="path-all-paths">ALL PATHS:</label><div class="nerve-line"></div><input id="path-all-paths" type="checkbox" checked/>`);
|
|
120
|
-
for (const path of
|
|
120
|
+
for (const path of this.__pathTypes) {
|
|
121
121
|
innerHTML.push(`<label for="path-${path.type}">${path.label}</label><div class="nerve-line nerve-${path.type}"></div><input id="path-${path.type}" type="checkbox" checked/>`);
|
|
122
122
|
}
|
|
123
123
|
this._legend.innerHTML = innerHTML.join('\n');
|
|
124
|
-
this.__checkedCount =
|
|
124
|
+
this.__checkedCount = this.__pathTypes.length;
|
|
125
125
|
this.__halfCount = Math.trunc(this.__checkedCount/2);
|
|
126
126
|
|
|
127
127
|
this._button = document.createElement('button');
|
|
@@ -164,11 +164,11 @@ export class PathControl
|
|
|
164
164
|
event.target.indeterminate = false;
|
|
165
165
|
}
|
|
166
166
|
if (event.target.checked) {
|
|
167
|
-
this.__checkedCount =
|
|
167
|
+
this.__checkedCount = this.__pathTypes.length;
|
|
168
168
|
} else {
|
|
169
169
|
this.__checkedCount = 0;
|
|
170
170
|
}
|
|
171
|
-
for (const path of
|
|
171
|
+
for (const path of this.__pathTypes) {
|
|
172
172
|
const pathCheckbox = document.getElementById(`path-${path.type}`);
|
|
173
173
|
if (pathCheckbox) {
|
|
174
174
|
pathCheckbox.checked = event.target.checked;
|
|
@@ -187,7 +187,7 @@ export class PathControl
|
|
|
187
187
|
if (this.__checkedCount === 0) {
|
|
188
188
|
allPathsCheckbox.checked = false;
|
|
189
189
|
allPathsCheckbox.indeterminate = false;
|
|
190
|
-
} else if (this.__checkedCount ===
|
|
190
|
+
} else if (this.__checkedCount === this.__pathTypes.length) {
|
|
191
191
|
allPathsCheckbox.checked = true;
|
|
192
192
|
allPathsCheckbox.indeterminate = false;
|
|
193
193
|
} else {
|
|
@@ -327,7 +327,7 @@ export class BackgroundControl
|
|
|
327
327
|
getDefaultPosition()
|
|
328
328
|
//==================
|
|
329
329
|
{
|
|
330
|
-
return '
|
|
330
|
+
return 'bottom-right';
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
onAdd(map)
|
package/src/flatmap-viewer.js
CHANGED
|
@@ -658,7 +658,10 @@ class FlatMap
|
|
|
658
658
|
setColour(options=null)
|
|
659
659
|
//=====================
|
|
660
660
|
{
|
|
661
|
-
options = utils.
|
|
661
|
+
options = utils.setDefaults(options, {
|
|
662
|
+
colour: true,
|
|
663
|
+
outline: true
|
|
664
|
+
});
|
|
662
665
|
if (this._userInteractions !== null) {
|
|
663
666
|
this._userInteractions.setColour(options);
|
|
664
667
|
}
|
|
@@ -696,6 +699,8 @@ class FlatMap
|
|
|
696
699
|
setBackgroundColour(colour)
|
|
697
700
|
//=========================
|
|
698
701
|
{
|
|
702
|
+
localStorage.setItem('flatmap-background-colour', colour);
|
|
703
|
+
|
|
699
704
|
this._map.setPaintProperty('background', 'background-color', colour);
|
|
700
705
|
|
|
701
706
|
if (this._minimap) {
|
|
@@ -1023,7 +1028,11 @@ class FlatMap
|
|
|
1023
1028
|
zoomToFeatures(externalIds, options=null)
|
|
1024
1029
|
//=======================================
|
|
1025
1030
|
{
|
|
1026
|
-
options = utils.
|
|
1031
|
+
options = utils.setDefaults(options, {
|
|
1032
|
+
select: true,
|
|
1033
|
+
highlight: false,
|
|
1034
|
+
padding:100
|
|
1035
|
+
});
|
|
1027
1036
|
if (this._userInteractions !== null) {
|
|
1028
1037
|
const featureIds = this.modelFeatureIdList(externalIds);
|
|
1029
1038
|
this._userInteractions.zoomToFeatures(featureIds, options);
|
|
@@ -1216,19 +1225,7 @@ export class MapManager
|
|
|
1216
1225
|
mapOptions['bounds'] = mapIndex['bounds'];
|
|
1217
1226
|
}
|
|
1218
1227
|
|
|
1219
|
-
//
|
|
1220
|
-
|
|
1221
|
-
if (!('pathControls' in mapOptions)) {
|
|
1222
|
-
mapOptions['pathControls'] = true;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
// Default is to show layer controls
|
|
1226
|
-
|
|
1227
|
-
if (!('layerControl' in mapOptions)) {
|
|
1228
|
-
mapOptions['layerControl'] = true;
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
// Mapmaker's changed the name of the field to indicate that indicates if
|
|
1228
|
+
// Mapmaker has changed the name of the field to indicate that indicates if
|
|
1232
1229
|
// there are raster layers
|
|
1233
1230
|
if (!('image-layers' in mapIndex) && ('image_layer' in mapIndex)) {
|
|
1234
1231
|
mapIndex['image-layers'] = mapIndex['image_layer'];
|
package/src/interactions.js
CHANGED
|
@@ -37,7 +37,7 @@ import {ContextMenu} from './contextmenu.js';
|
|
|
37
37
|
import {displayedProperties} from './info.js';
|
|
38
38
|
import {InfoControl} from './info.js';
|
|
39
39
|
import {LayerManager} from './layers.js';
|
|
40
|
-
import {PATHWAYS_LAYER, Pathways} from './pathways.js';
|
|
40
|
+
import {PATH_TYPES, PATHWAYS_LAYER, Pathways} from './pathways.js';
|
|
41
41
|
import {BackgroundControl, LayerControl, PathControl} from './controls.js';
|
|
42
42
|
import {SearchControl} from './search.js';
|
|
43
43
|
import {VECTOR_TILES_SOURCE} from './styling.js';
|
|
@@ -163,7 +163,8 @@ export class UserInteractions
|
|
|
163
163
|
// Add a control to manage our pathways
|
|
164
164
|
|
|
165
165
|
if (flatmap.options.pathControls) {
|
|
166
|
-
|
|
166
|
+
// Restrict to path types that are on the map...
|
|
167
|
+
this._map.addControl(new PathControl(flatmap, this._pathways.pathTypes));
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
// Add a control to manage our layers
|
|
@@ -529,7 +530,12 @@ export class UserInteractions
|
|
|
529
530
|
zoomToFeatures(featureIds, options=null)
|
|
530
531
|
//======================================
|
|
531
532
|
{
|
|
532
|
-
options = utils.
|
|
533
|
+
options = utils.setDefaults(options, {
|
|
534
|
+
select: true,
|
|
535
|
+
highlight:
|
|
536
|
+
false, noZoomIn:
|
|
537
|
+
false, padding:10
|
|
538
|
+
});
|
|
533
539
|
const select = (options.select === true);
|
|
534
540
|
const highlight = (options.highlight === true);
|
|
535
541
|
if (featureIds.length) {
|
|
@@ -667,9 +673,9 @@ export class UserInteractions
|
|
|
667
673
|
: '';
|
|
668
674
|
if ('hyperlink' in properties) {
|
|
669
675
|
if (label === '') {
|
|
670
|
-
return `<div class='flatmap-feature-label'><a href='{properties.hyperlink}'>${properties.hyperlink}</a></div>`;
|
|
676
|
+
return `<div class='flatmap-feature-label'><a href='${properties.hyperlink}'>${properties.hyperlink}</a></div>`;
|
|
671
677
|
} else {
|
|
672
|
-
return `<div class='flatmap-feature-label'><a href='{properties.hyperlink}'>${
|
|
678
|
+
return `<div class='flatmap-feature-label'><a href='${properties.hyperlink}'>${label}</a></div>`;
|
|
673
679
|
}
|
|
674
680
|
} else {
|
|
675
681
|
return `<div class='flatmap-feature-label'>${label}</div>`;
|
package/src/layers.js
CHANGED
|
@@ -27,20 +27,21 @@ import {PATHWAYS_LAYER} from './pathways.js';
|
|
|
27
27
|
import * as style from './styling.js';
|
|
28
28
|
import * as utils from './utils.js';
|
|
29
29
|
|
|
30
|
-
const FEATURES_LAYER = 'features'
|
|
31
|
-
const RASTER_LAYERS_NAME = 'Background image layer'
|
|
30
|
+
const FEATURES_LAYER = 'features';
|
|
31
|
+
const RASTER_LAYERS_NAME = 'Background image layer';
|
|
32
|
+
const RASTER_LAYERS_ID = 'background-image-layer';
|
|
32
33
|
|
|
33
34
|
//==============================================================================
|
|
34
35
|
|
|
35
36
|
class MapStylingLayers
|
|
36
37
|
{
|
|
37
|
-
constructor(flatmap, layerId)
|
|
38
|
+
constructor(flatmap, layerId, options)
|
|
38
39
|
{
|
|
39
40
|
this.__map = flatmap.map;
|
|
40
41
|
this.__id = layerId;
|
|
41
42
|
this.__layers = [];
|
|
42
43
|
this.__active = true;
|
|
43
|
-
this.__layerOptions =
|
|
44
|
+
this.__layerOptions = options;
|
|
44
45
|
this.__separateLayers = flatmap.options.separateLayers;
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -90,9 +91,9 @@ class MapStylingLayers
|
|
|
90
91
|
|
|
91
92
|
class MapFeatureLayers extends MapStylingLayers
|
|
92
93
|
{
|
|
93
|
-
constructor(flatmap, layer)
|
|
94
|
+
constructor(flatmap, layer, options)
|
|
94
95
|
{
|
|
95
|
-
super(flatmap, layer.id);
|
|
96
|
+
super(flatmap, layer.id, options);
|
|
96
97
|
const vectorTileSource = this.__map.getSource('vector-tiles');
|
|
97
98
|
const haveVectorLayers = (typeof vectorTileSource !== 'undefined');
|
|
98
99
|
|
|
@@ -161,9 +162,9 @@ class MapFeatureLayers extends MapStylingLayers
|
|
|
161
162
|
|
|
162
163
|
class MapRasterLayers extends MapStylingLayers
|
|
163
164
|
{
|
|
164
|
-
constructor(flatmap, bodyLayerId=null)
|
|
165
|
+
constructor(flatmap, options, bodyLayerId=null)
|
|
165
166
|
{
|
|
166
|
-
super(flatmap,
|
|
167
|
+
super(flatmap, RASTER_LAYERS_ID, options);
|
|
167
168
|
if (bodyLayerId !== null) {
|
|
168
169
|
const layerId = `${bodyLayerId}_${FEATURES_LAYER}`;
|
|
169
170
|
const source = flatmap.options.separateLayers ? layerId : FEATURES_LAYER;
|
|
@@ -210,7 +211,10 @@ export class LayerManager
|
|
|
210
211
|
this.__map = flatmap.map;
|
|
211
212
|
this.__layers = new Map;
|
|
212
213
|
this.__mapLayers = new Map;
|
|
213
|
-
|
|
214
|
+
this.__layerOptions = utils.setDefaults(flatmap.options.layerOptions, {
|
|
215
|
+
colour: true,
|
|
216
|
+
outline: true
|
|
217
|
+
});;
|
|
214
218
|
const backgroundLayer = new style.BackgroundLayer();
|
|
215
219
|
if ('background' in flatmap.options) {
|
|
216
220
|
this.__map.addLayer(backgroundLayer.style(flatmap.options.background));
|
|
@@ -220,20 +224,23 @@ export class LayerManager
|
|
|
220
224
|
|
|
221
225
|
// Add the map's layers
|
|
222
226
|
if (flatmap.details['image-layers']) {
|
|
223
|
-
|
|
227
|
+
this.__layerOptions.activeRasterLayer = true;
|
|
224
228
|
|
|
229
|
+
// Image layers are below all feature layers
|
|
225
230
|
const bodyLayer = flatmap.layers[0];
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
const rasterLayers = new MapRasterLayers(this.__flatmap,
|
|
232
|
+
this.__layerOptions,
|
|
233
|
+
bodyLayer.id); // body layer if not FC??
|
|
229
234
|
for (const layer of flatmap.layers) {
|
|
230
235
|
rasterLayers.addLayer(layer);
|
|
231
236
|
}
|
|
232
|
-
this.__layers.set(
|
|
233
|
-
id:
|
|
237
|
+
this.__layers.set(RASTER_LAYERS_ID, {
|
|
238
|
+
id: RASTER_LAYERS_ID,
|
|
234
239
|
description: RASTER_LAYERS_NAME
|
|
235
240
|
});
|
|
236
|
-
this.__mapLayers.set(
|
|
241
|
+
this.__mapLayers.set(RASTER_LAYERS_ID, rasterLayers);
|
|
242
|
+
} else {
|
|
243
|
+
this.__layerOptions.activeRasterLayer = false;
|
|
237
244
|
}
|
|
238
245
|
for (const layer of flatmap.layers) {
|
|
239
246
|
this.__addFeatureLayer(layer);
|
|
@@ -256,7 +263,9 @@ export class LayerManager
|
|
|
256
263
|
//======================
|
|
257
264
|
{
|
|
258
265
|
this.__layers.set(layer.id, layer);
|
|
259
|
-
this.__mapLayers.set(layer.id, new MapFeatureLayers(this.__flatmap,
|
|
266
|
+
this.__mapLayers.set(layer.id, new MapFeatureLayers(this.__flatmap,
|
|
267
|
+
layer,
|
|
268
|
+
this.__layerOptions));
|
|
260
269
|
}
|
|
261
270
|
|
|
262
271
|
get layers()
|
|
@@ -268,18 +277,26 @@ export class LayerManager
|
|
|
268
277
|
activate(layerId, enable=true)
|
|
269
278
|
//============================
|
|
270
279
|
{
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
273
|
-
|
|
280
|
+
const layer = this.__mapLayers.get(layerId);
|
|
281
|
+
if (layer !== undefined) {
|
|
282
|
+
layer.activate(enable);
|
|
283
|
+
if (layer.id === RASTER_LAYERS_ID) {
|
|
284
|
+
this.__layerOptions.activeRasterLayer = enable;
|
|
285
|
+
for (const mapLayer of this.__mapLayers.values()) {
|
|
286
|
+
if (mapLayer.id !== RASTER_LAYERS_ID) {
|
|
287
|
+
mapLayer.setColour(this.__layerOptions);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
274
291
|
}
|
|
275
292
|
}
|
|
276
293
|
|
|
277
294
|
setColour(options=null)
|
|
278
295
|
//=====================
|
|
279
296
|
{
|
|
280
|
-
|
|
297
|
+
this.__layerOptions = utils.setDefaults(options, this.__layerOptions);
|
|
281
298
|
for (const mapLayer of this.__mapLayers.values()) {
|
|
282
|
-
mapLayer.setColour(
|
|
299
|
+
mapLayer.setColour(this.__layerOptions);
|
|
283
300
|
}
|
|
284
301
|
}
|
|
285
302
|
}
|
package/src/main.js
CHANGED
|
@@ -52,7 +52,7 @@ export async function standaloneViewer(map_endpoint=null, options={})
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
let currentMap = null;
|
|
55
|
-
let defaultBackground = 'black';
|
|
55
|
+
let defaultBackground = localStorage.getItem('flatmap-background-colour') || 'black';
|
|
56
56
|
|
|
57
57
|
const mapOptions = Object.assign({
|
|
58
58
|
tooltips: true,
|
|
@@ -62,7 +62,9 @@ export async function standaloneViewer(map_endpoint=null, options={})
|
|
|
62
62
|
minimap: false,
|
|
63
63
|
searchable: true,
|
|
64
64
|
featureInfo: true,
|
|
65
|
-
showPosition: false
|
|
65
|
+
showPosition: false,
|
|
66
|
+
pathControls: true,
|
|
67
|
+
layerControl: true
|
|
66
68
|
}, options);
|
|
67
69
|
|
|
68
70
|
function loadMap(id, taxon, sex)
|
package/src/pathways.js
CHANGED
|
@@ -38,6 +38,9 @@ export const PATH_TYPES = [
|
|
|
38
38
|
{ type: "other", label: "Other neuron type", colour: "#888"}
|
|
39
39
|
];
|
|
40
40
|
|
|
41
|
+
export const PATH_STYLE_RULES =
|
|
42
|
+
PATH_TYPES.flatMap(pathType => [['==', ['get', 'kind'], pathType.type], pathType.colour]);
|
|
43
|
+
|
|
41
44
|
//==============================================================================
|
|
42
45
|
|
|
43
46
|
function reverseMap(mapping)
|
|
@@ -138,6 +141,19 @@ export class Pathways
|
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
|
|
144
|
+
get pathTypes()
|
|
145
|
+
//=============
|
|
146
|
+
{
|
|
147
|
+
const pathTypes = [];
|
|
148
|
+
for (const pathType of PATH_TYPES) {
|
|
149
|
+
if (pathType.type in this.__typePaths
|
|
150
|
+
&& this.__typePaths[pathType.type].length > 0) {
|
|
151
|
+
pathTypes.push(pathType);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return pathTypes;
|
|
155
|
+
}
|
|
156
|
+
|
|
141
157
|
addPathsToFeatureSet_(paths, featureSet)
|
|
142
158
|
//======================================
|
|
143
159
|
{
|
package/src/styling.js
CHANGED
|
@@ -26,6 +26,10 @@ export const VECTOR_TILES_SOURCE = 'vector-tiles';
|
|
|
26
26
|
|
|
27
27
|
//==============================================================================
|
|
28
28
|
|
|
29
|
+
import {PATH_STYLE_RULES} from './pathways.js';
|
|
30
|
+
|
|
31
|
+
//==============================================================================
|
|
32
|
+
|
|
29
33
|
class VectorStyleLayer
|
|
30
34
|
{
|
|
31
35
|
constructor(id, suffix, sourceLayer)
|
|
@@ -114,6 +118,7 @@ export class FeatureFillLayer extends VectorStyleLayer
|
|
|
114
118
|
{
|
|
115
119
|
const coloured = !('colour' in options) || options.colour;
|
|
116
120
|
const dimmed = 'dimmed' in options && options.dimmed;
|
|
121
|
+
const activeRasterLayer = 'activeRasterLayer' in options && options.activeRasterLayer;
|
|
117
122
|
const paintStyle = {
|
|
118
123
|
'fill-color': [
|
|
119
124
|
'case',
|
|
@@ -128,15 +133,15 @@ export class FeatureFillLayer extends VectorStyleLayer
|
|
|
128
133
|
],
|
|
129
134
|
'fill-opacity': [
|
|
130
135
|
'case',
|
|
136
|
+
['boolean', ['feature-state', 'selected'], false], 0.7,
|
|
137
|
+
['has', 'colour'], activeRasterLayer ? 0.008 : 1.0,
|
|
138
|
+
['boolean', ['feature-state', 'active'], false], 0.7,
|
|
139
|
+
['has', 'node'], 0.3,
|
|
131
140
|
['any',
|
|
132
141
|
['==', ['get', 'kind'], 'scaffold'],
|
|
133
142
|
['==', ['get', 'kind'], 'tissue'],
|
|
134
143
|
['==', ['get', 'kind'], 'cell-type'],
|
|
135
144
|
], 0.1,
|
|
136
|
-
['has', 'node'], 0.3,
|
|
137
|
-
['boolean', ['feature-state', 'active'], false], 0.8,
|
|
138
|
-
['boolean', ['feature-state', 'selected'], false], 0.01,
|
|
139
|
-
['has', 'colour'], 0.008,
|
|
140
145
|
(coloured && !dimmed) ? 0.01 : 0.1
|
|
141
146
|
]
|
|
142
147
|
};
|
|
@@ -175,6 +180,7 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
175
180
|
const coloured = !('colour' in options) || options.colour;
|
|
176
181
|
const outlined = !('outline' in options) || options.outline;
|
|
177
182
|
const dimmed = 'dimmed' in options && options.dimmed;
|
|
183
|
+
const activeRasterLayer = 'activeRasterLayer' in options && options.activeRasterLayer;
|
|
178
184
|
const lineColour = [ 'case' ];
|
|
179
185
|
lineColour.push(['boolean', ['feature-state', 'selected'], false]);
|
|
180
186
|
lineColour.push('red');
|
|
@@ -183,7 +189,7 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
183
189
|
lineColour.push('blue');
|
|
184
190
|
}
|
|
185
191
|
lineColour.push(['has', 'colour']);
|
|
186
|
-
lineColour.push(
|
|
192
|
+
lineColour.push('#000');
|
|
187
193
|
lineColour.push(['has', 'node']);
|
|
188
194
|
lineColour.push('#AFA202');
|
|
189
195
|
lineColour.push('#444');
|
|
@@ -198,7 +204,11 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
198
204
|
}
|
|
199
205
|
lineOpacity.push(['boolean', ['feature-state', 'selected'], false]);
|
|
200
206
|
lineOpacity.push(0.9);
|
|
201
|
-
|
|
207
|
+
if (activeRasterLayer) {
|
|
208
|
+
lineOpacity.push((outlined && !dimmed) ? 0.3 : 0.1);
|
|
209
|
+
} else {
|
|
210
|
+
lineOpacity.push(0.5);
|
|
211
|
+
}
|
|
202
212
|
|
|
203
213
|
const lineWidth = [
|
|
204
214
|
'case',
|
|
@@ -208,8 +218,10 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
208
218
|
lineWidth.push(2.5);
|
|
209
219
|
if (coloured && outlined) {
|
|
210
220
|
lineWidth.push(['boolean', ['feature-state', 'active'], false]);
|
|
211
|
-
lineWidth.push(1);
|
|
221
|
+
lineWidth.push(1.5);
|
|
212
222
|
}
|
|
223
|
+
lineWidth.push(['has', 'colour']);
|
|
224
|
+
lineWidth.push(0.7);
|
|
213
225
|
lineWidth.push((coloured && outlined) ? 0.5 : 0.1);
|
|
214
226
|
|
|
215
227
|
return super.changedPaintStyle({
|
|
@@ -271,8 +283,9 @@ export class FeatureLineLayer extends VectorStyleLayer
|
|
|
271
283
|
],
|
|
272
284
|
'line-opacity': [
|
|
273
285
|
'case',
|
|
274
|
-
|
|
275
|
-
|
|
286
|
+
['boolean', ['feature-state', 'selected'], false], 1.0,
|
|
287
|
+
['has', 'colour'], 1.0,
|
|
288
|
+
['boolean', ['feature-state', 'active'], false], 1.0,
|
|
276
289
|
0.3
|
|
277
290
|
],
|
|
278
291
|
'line-width': [
|
|
@@ -360,25 +373,18 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
360
373
|
['boolean', ['feature-state', 'hidden'], false], '#CCC',
|
|
361
374
|
['==', ['get', 'type'], 'bezier'], 'red',
|
|
362
375
|
['==', ['get', 'kind'], 'error'], '#FFFE0E',
|
|
363
|
-
['==', ['get', 'kind'], 'unknown'], '#
|
|
364
|
-
|
|
365
|
-
['==', ['get', 'kind'], 'lcn'], '#F19E38',
|
|
366
|
-
['==', ['get', 'kind'], 'para-post'], '#3F8F4A',
|
|
367
|
-
['==', ['get', 'kind'], 'para-pre'], '#3F8F4A',
|
|
368
|
-
['==', ['get', 'kind'], 'somatic'], '#98561D',
|
|
369
|
-
['==', ['get', 'kind'], 'sensory'], '#2A62F6',
|
|
370
|
-
['==', ['get', 'kind'], 'symp-post'], '#EA3423',
|
|
371
|
-
['==', ['get', 'kind'], 'symp-pre'], '#EA3423',
|
|
376
|
+
['==', ['get', 'kind'], 'unknown'], '#888',
|
|
377
|
+
...PATH_STYLE_RULES,
|
|
372
378
|
'#888'
|
|
373
379
|
],
|
|
374
380
|
'line-opacity': [
|
|
375
381
|
'case',
|
|
376
|
-
['boolean', ['feature-state', 'hidden'], false], 0.
|
|
382
|
+
['boolean', ['feature-state', 'hidden'], false], 0.05,
|
|
377
383
|
['==', ['get', 'type'], 'bezier'], 1.0,
|
|
378
384
|
['boolean', ['get', 'invisible'], false], 0.001,
|
|
379
385
|
['boolean', ['feature-state', 'selected'], false], 1.0,
|
|
380
|
-
['boolean', ['feature-state', 'active'], false], 0
|
|
381
|
-
dimmed ? 0.1 : 0.
|
|
386
|
+
['boolean', ['feature-state', 'active'], false], 1.0,
|
|
387
|
+
dimmed ? 0.1 : 0.8
|
|
382
388
|
],
|
|
383
389
|
'line-width': [
|
|
384
390
|
'let',
|
|
@@ -389,7 +395,7 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
389
395
|
['==', ['get', 'kind'], 'unknown'], 1,
|
|
390
396
|
['boolean', ['get', 'invisible'], false], 0.1,
|
|
391
397
|
['boolean', ['feature-state', 'selected'], false], 1.2,
|
|
392
|
-
['boolean', ['feature-state', 'active'], false],
|
|
398
|
+
['boolean', ['feature-state', 'active'], false], 1.2,
|
|
393
399
|
0.8
|
|
394
400
|
], [
|
|
395
401
|
'interpolate',
|
|
@@ -561,14 +567,7 @@ export class NervePolygonFill extends VectorStyleLayer
|
|
|
561
567
|
'case',
|
|
562
568
|
['==', ['get', 'kind'], 'bezier-end'], 'red',
|
|
563
569
|
['==', ['get', 'kind'], 'bezier-control'], 'green',
|
|
564
|
-
|
|
565
|
-
['==', ['get', 'kind'], 'lcn'], '#F19E38',
|
|
566
|
-
['==', ['get', 'kind'], 'para-post'], '#3F8F4A',
|
|
567
|
-
['==', ['get', 'kind'], 'para-pre'], '#3F8F4A',
|
|
568
|
-
['==', ['get', 'kind'], 'somatic'], '#98561D',
|
|
569
|
-
['==', ['get', 'kind'], 'sensory'], '#2A62F6',
|
|
570
|
-
['==', ['get', 'kind'], 'symp-post'], '#EA3423',
|
|
571
|
-
['==', ['get', 'kind'], 'symp-pre'], '#EA3423',
|
|
570
|
+
...PATH_STYLE_RULES,
|
|
572
571
|
'white'
|
|
573
572
|
],
|
|
574
573
|
'fill-opacity': [
|
package/src/utils.js
CHANGED
|
@@ -110,7 +110,7 @@ export function normaliseId(id)
|
|
|
110
110
|
|
|
111
111
|
//==============================================================================
|
|
112
112
|
|
|
113
|
-
export function
|
|
113
|
+
export function setDefaults(options, defaultOptions)
|
|
114
114
|
{
|
|
115
115
|
if (options === undefined || options === null) {
|
|
116
116
|
return defaultOptions;
|