@abi-software/flatmap-viewer 2.2.10-devel.2 → 2.2.11-devel.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/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)
@@ -130,7 +134,8 @@ export class FeatureFillLayer extends VectorStyleLayer
130
134
  'fill-opacity': [
131
135
  'case',
132
136
  ['boolean', ['feature-state', 'selected'], false], 0.7,
133
- ['has', 'colour'], activeRasterLayer ? 0.008 : 1.0,
137
+ ['has', 'opacity'], ['get', 'opacity'],
138
+ ['has', 'colour'], 1.0,
134
139
  ['boolean', ['feature-state', 'active'], false], 0.7,
135
140
  ['has', 'node'], 0.3,
136
141
  ['any',
@@ -188,6 +193,7 @@ export class FeatureBorderLayer extends VectorStyleLayer
188
193
  lineColour.push('#000');
189
194
  lineColour.push(['has', 'node']);
190
195
  lineColour.push('#AFA202');
196
+ // this colour should be complement of background colour...
191
197
  lineColour.push('#444');
192
198
 
193
199
  const lineOpacity = [
@@ -257,7 +263,6 @@ export class FeatureLineLayer extends VectorStyleLayer
257
263
  :
258
264
  [
259
265
  'any',
260
- ['has', 'centreline'],
261
266
  ['==', 'type', 'bezier'],
262
267
  ['==', 'type', `line`]
263
268
  ];
@@ -274,7 +279,6 @@ export class FeatureLineLayer extends VectorStyleLayer
274
279
  ['has', 'colour'], ['get', 'colour'],
275
280
  ['boolean', ['feature-state', 'active'], false], coloured ? '#888' : '#CCC',
276
281
  ['==', ['get', 'type'], 'network'], '#AFA202',
277
- ['has', 'centreline'], '#888',
278
282
  options.authoring ? '#C44' : '#444'
279
283
  ],
280
284
  'line-opacity': [
@@ -288,7 +292,6 @@ export class FeatureLineLayer extends VectorStyleLayer
288
292
  'let',
289
293
  'width', [
290
294
  'case',
291
- ['has', 'centreline'], 1.2,
292
295
  ['==', ['get', 'type'], 'network'], 1.2,
293
296
  ['boolean', ['feature-state', 'selected'], false], 1.2,
294
297
  ['boolean', ['feature-state', 'active'], false], 1.2,
@@ -354,6 +357,7 @@ export class PathLineLayer extends VectorStyleLayer
354
357
  [
355
358
  'any',
356
359
  ['==', 'type', 'bezier'],
360
+ ['==', 'type', 'centreline'],
357
361
  ['==', 'type', `line`]
358
362
  ];
359
363
  this.__dashed = dashed;
@@ -368,40 +372,36 @@ export class PathLineLayer extends VectorStyleLayer
368
372
  ['boolean', ['feature-state', 'selected'], false], '#0F0',
369
373
  ['boolean', ['feature-state', 'hidden'], false], '#CCC',
370
374
  ['==', ['get', 'type'], 'bezier'], 'red',
371
- ['==', ['get', 'kind'], 'error'], '#FFFE0E',
375
+ ['==', ['get', 'type'], 'centreline'], '#00F',
376
+ ['has', 'error'], '#FFFE0E',
372
377
  ['==', ['get', 'kind'], 'unknown'], '#888',
373
- ['==', ['get', 'kind'], 'cns'], '#9B1FC1',
374
- ['==', ['get', 'kind'], 'lcn'], '#F19E38',
375
- ['==', ['get', 'kind'], 'para-post'], '#3F8F4A',
376
- ['==', ['get', 'kind'], 'para-pre'], '#3F8F4A',
377
- ['==', ['get', 'kind'], 'somatic'], '#98561D',
378
- ['==', ['get', 'kind'], 'sensory'], '#2A62F6',
379
- ['==', ['get', 'kind'], 'symp-post'], '#EA3423',
380
- ['==', ['get', 'kind'], 'symp-pre'], '#EA3423',
378
+ ...PATH_STYLE_RULES,
381
379
  '#888'
382
380
  ],
383
381
  'line-opacity': [
384
382
  'case',
385
- ['boolean', ['feature-state', 'hidden'], false], 0.1,
383
+ ['boolean', ['feature-state', 'hidden'], false], 0.05,
386
384
  ['==', ['get', 'type'], 'bezier'], 1.0,
387
385
  ['boolean', ['get', 'invisible'], false], 0.001,
388
386
  ['boolean', ['feature-state', 'selected'], false], 1.0,
389
- ['boolean', ['feature-state', 'active'], false], 0.8,
390
- dimmed ? 0.1 : 0.5
387
+ ['boolean', ['feature-state', 'active'], false], 1.0,
388
+ // Only dim lines when other lines are selected, not if just features selected??
389
+ dimmed ? 0.1 : 0.8
391
390
  ],
392
391
  'line-width': [
393
392
  'let',
394
- 'width', [
393
+ 'width', ["*", [
395
394
  'case',
396
395
  ['==', ['get', 'type'], 'bezier'], 0.1,
397
- ['==', ['get', 'kind'], 'error'], 1,
396
+ ['has', 'error'], 1,
398
397
  ['==', ['get', 'kind'], 'unknown'], 1,
399
398
  ['boolean', ['get', 'invisible'], false], 0.1,
400
- ['boolean', ['feature-state', 'selected'], false], 1.2,
399
+ ['boolean', ['feature-state', 'selected'], false], 0.6,
401
400
  ['boolean', ['feature-state', 'active'], false], 0.9,
402
- 0.8
403
- ], [
404
- 'interpolate',
401
+ 0.6
402
+ ],
403
+ ['case', ['has', 'stroke-width'], ['get', 'stroke-width'], 1.0]],
404
+ ['interpolate',
405
405
  ['exponential', 2],
406
406
  ['zoom'],
407
407
  2, ["*", ['var', 'width'], ["^", 2, -0.5]],
@@ -411,7 +411,7 @@ export class PathLineLayer extends VectorStyleLayer
411
411
  ]
412
412
  };
413
413
  if (this.__dashed) {
414
- paintStyle['line-dasharray'] = [3, 2];
414
+ paintStyle['line-dasharray'] = [1, 1];
415
415
  }
416
416
  return super.changedPaintStyle(paintStyle, changes);
417
417
  }
@@ -570,14 +570,7 @@ export class NervePolygonFill extends VectorStyleLayer
570
570
  'case',
571
571
  ['==', ['get', 'kind'], 'bezier-end'], 'red',
572
572
  ['==', ['get', 'kind'], 'bezier-control'], 'green',
573
- ['==', ['get', 'kind'], 'cns'], '#9B1FC1',
574
- ['==', ['get', 'kind'], 'lcn'], '#F19E38',
575
- ['==', ['get', 'kind'], 'para-post'], '#3F8F4A',
576
- ['==', ['get', 'kind'], 'para-pre'], '#3F8F4A',
577
- ['==', ['get', 'kind'], 'somatic'], '#98561D',
578
- ['==', ['get', 'kind'], 'sensory'], '#2A62F6',
579
- ['==', ['get', 'kind'], 'symp-post'], '#EA3423',
580
- ['==', ['get', 'kind'], 'symp-pre'], '#EA3423',
573
+ ...PATH_STYLE_RULES,
581
574
  'white'
582
575
  ],
583
576
  'fill-opacity': [