@abi-software/flatmap-viewer 2.4.2-b.5 → 2.4.4

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
@@ -52,7 +52,7 @@ const STROKE_INTERPOLATION = [
52
52
  ['zoom'],
53
53
  2, ["*", ['var', 'width'], ["^", 2, -0.5]],
54
54
  7, ["*", ['var', 'width'], ["^", 2, 2.5]],
55
- 9, ["*", ['var', 'width'], ["^", 2, 4.0]]
55
+ 9, ["*", ['var', 'width'], ["^", 2, 3.0]]
56
56
  ];
57
57
 
58
58
  //==============================================================================
@@ -162,7 +162,7 @@ export class FeatureFillLayer extends VectorStyleLayer
162
162
  'fill-opacity': [
163
163
  'case',
164
164
  ['boolean', ['feature-state', 'hidden'], false], 0.1,
165
- ['boolean', ['feature-state', 'selected'], false], 0.5,
165
+ ['boolean', ['feature-state', 'selected'], false], 0.2,
166
166
  ['has', 'opacity'], ['get', 'opacity'],
167
167
  ['has', 'colour'], 1.0,
168
168
  ['boolean', ['feature-state', 'active'], false], 0.7,
@@ -206,53 +206,37 @@ export class FeatureBorderLayer extends VectorStyleLayer
206
206
  const outlined = !('outline' in options) || options.outline;
207
207
  const dimmed = 'dimmed' in options && options.dimmed;
208
208
  const activeRasterLayer = 'activeRasterLayer' in options && options.activeRasterLayer;
209
- const lineColour = [ 'case' ];
210
- lineColour.push(['boolean', ['feature-state', 'hidden'], false]);
211
- lineColour.push(COLOUR_HIDDEN);
212
- lineColour.push(['boolean', ['feature-state', 'selected'], false]);
213
- lineColour.push(FEATURE_SELECTED_BORDER);
209
+ const lineColour = ['case'];
210
+ lineColour.push(['boolean', ['feature-state', 'hidden'], false], COLOUR_HIDDEN);
211
+ lineColour.push(['boolean', ['feature-state', 'selected'], false], FEATURE_SELECTED_BORDER);
214
212
  if (coloured && outlined) {
215
- lineColour.push(['boolean', ['feature-state', 'active'], false]);
216
- lineColour.push(COLOUR_ACTIVE);
213
+ lineColour.push(['boolean', ['feature-state', 'active'], false], COLOUR_ACTIVE);
217
214
  }
218
- lineColour.push(['boolean', ['feature-state', 'annotated'], false]);
219
- lineColour.push(COLOUR_ANNOTATED);
220
- lineColour.push(['has', 'colour']);
221
- lineColour.push(['get', 'colour']);
215
+ lineColour.push(['boolean', ['feature-state', 'annotated'], false], COLOUR_ANNOTATED);
216
+ lineColour.push(['has', 'colour'], ['get', 'colour']);
222
217
  lineColour.push('#444');
223
218
 
224
- const lineOpacity = [
225
- 'case',
226
- ['boolean', ['feature-state', 'hidden'], false], 0.05,
227
- ];
219
+ const lineOpacity = ['case'];
220
+ lineOpacity.push(['boolean', ['feature-state', 'hidden'], false], 0.05);
228
221
  if (coloured && outlined) {
229
- lineOpacity.push(['boolean', ['feature-state', 'active'], false]);
230
- lineOpacity.push(0.9);
222
+ lineOpacity.push(['boolean', ['feature-state', 'active'], false], 0.9);
231
223
  }
232
- lineOpacity.push(['boolean', ['feature-state', 'selected'], false]);
233
- lineOpacity.push(0.9);
234
- lineOpacity.push(['boolean', ['feature-state', 'annotated'], false]);
235
- lineOpacity.push(0.9);
224
+ lineOpacity.push(['boolean', ['feature-state', 'selected'], false], 0.9);
225
+ lineOpacity.push(['boolean', ['feature-state', 'annotated'], false], 0.9);
236
226
  if (activeRasterLayer) {
237
227
  lineOpacity.push((outlined && !dimmed) ? 0.3 : 0.1);
238
228
  } else {
239
229
  lineOpacity.push(0.5);
240
230
  }
241
231
 
242
- const lineWidth = [
243
- 'case',
244
- ['boolean', ['get', 'invisible'], false], 0.2,
245
- ];
246
- lineWidth.push(['boolean', ['feature-state', 'selected'], false]);
247
- lineWidth.push(2.5);
232
+ const lineWidth = ['case'];
233
+ lineWidth.push(['boolean', ['get', 'invisible'], false], 0.2);
234
+ lineWidth.push(['boolean', ['feature-state', 'selected'], false], 1.5);
248
235
  if (coloured && outlined) {
249
- lineWidth.push(['boolean', ['feature-state', 'active'], false]);
250
- lineWidth.push(1.5);
236
+ lineWidth.push(['boolean', ['feature-state', 'active'], false], 1.5);
251
237
  }
252
- lineWidth.push(['boolean', ['feature-state', 'annotated'], false]);
253
- lineWidth.push(3.5);
254
- lineWidth.push(['has', 'colour']);
255
- lineWidth.push(0.7);
238
+ lineWidth.push(['boolean', ['feature-state', 'annotated'], false], 3.5);
239
+ lineWidth.push(['has', 'colour'], 0.7);
256
240
  lineWidth.push((coloured && outlined) ? 0.5 : 0.1);
257
241
 
258
242
  return super.changedPaintStyle({
@@ -293,14 +277,14 @@ export class FeatureLineLayer extends VectorStyleLayer
293
277
  return this.__dashed ? [
294
278
  'all',
295
279
  ['==', '$type', 'LineString'],
296
- ['==', 'type', `line-dash`]
280
+ ['==', 'type', 'line-dash']
297
281
  ] : [
298
282
  'all',
299
283
  ['==', '$type', 'LineString'],
300
284
  [
301
285
  'any',
302
286
  ['==', 'type', 'bezier'],
303
- ['==', 'type', `line`]
287
+ ['==', 'type', 'line']
304
288
  ]
305
289
  ];
306
290
  }
@@ -328,12 +312,17 @@ export class FeatureLineLayer extends VectorStyleLayer
328
312
  ],
329
313
  'line-width': [
330
314
  'let',
331
- 'width', [
332
- 'case',
333
- ['==', ['get', 'type'], 'network'], 1.2,
334
- ['boolean', ['feature-state', 'selected'], false], 1.2,
335
- ['boolean', ['feature-state', 'active'], false], 1.2,
336
- options.authoring ? 0.7 : 0.5
315
+ 'width', [
316
+ '*',
317
+ ['case',
318
+ ['has', 'stroke-width'], ['get', 'stroke-width'],
319
+ 1.0
320
+ ],
321
+ ['case',
322
+ ['boolean', ['feature-state', 'selected'], false], 1.2,
323
+ ['boolean', ['feature-state', 'active'], false], 1.2,
324
+ options.authoring ? 0.7 : 0.5
325
+ ]
337
326
  ],
338
327
  STROKE_INTERPOLATION
339
328
  ]
@@ -526,10 +515,6 @@ export class PathLineLayer extends VectorStyleLayer
526
515
  'line-color': [
527
516
  'let', 'active', ['to-number', ['feature-state', 'active'], 0],
528
517
  [ 'case',
529
- ['all',
530
- ['==', ['var', 'active'], 0],
531
- ['boolean', ['feature-state', 'selected'], false],
532
- ], COLOUR_SELECTED,
533
518
  ['boolean', ['feature-state', 'hidden'], false], COLOUR_HIDDEN,
534
519
  ['==', ['get', 'type'], 'bezier'], 'red',
535
520
  ...PATH_STYLE_RULES,
@@ -559,7 +544,9 @@ export class PathLineLayer extends VectorStyleLayer
559
544
  "*",
560
545
  this.__highlight ? ['case',
561
546
  ['boolean', ['get', 'invisible'], false], 0.1,
562
- ['boolean', ['feature-state', 'selected'], false], 0.6,
547
+ ['boolean', ['feature-state', 'selected'], false], [
548
+ 'case', ['boolean', ['feature-state', 'active'], false], 1.2,
549
+ 0.9],
563
550
  ['boolean', ['feature-state', 'active'], false], 0.9,
564
551
  0.0
565
552
  ] : [