@yuneta/gobj-ui 7.23.97 → 7.23.98

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.
@@ -9683,7 +9683,20 @@ function load_devices(gobj) {
9683
9683
  source: "devices",
9684
9684
  filter: ["has", "point_count"],
9685
9685
  layout: {
9686
- "text-field": "{point_count_abbreviated}",
9686
+ "text-field": [
9687
+ "case",
9688
+ [
9689
+ "<",
9690
+ ["get", "connected"],
9691
+ ["get", "point_count"]
9692
+ ],
9693
+ [
9694
+ "concat",
9695
+ ["get", "point_count_abbreviated"],
9696
+ " !"
9697
+ ],
9698
+ ["get", "point_count_abbreviated"]
9699
+ ],
9687
9700
  "text-font": ["Noto Sans Regular"],
9688
9701
  "text-size": 14
9689
9702
  },
@@ -9733,6 +9746,28 @@ function load_devices(gobj) {
9733
9746
  "circle-stroke-color": "#fff"
9734
9747
  }
9735
9748
  });
9749
+ map.addLayer({
9750
+ id: "unclustered-alert",
9751
+ type: "symbol",
9752
+ source: "devices",
9753
+ filter: [
9754
+ "all",
9755
+ ["!", ["has", "point_count"]],
9756
+ ["!", ["get", "connected"]]
9757
+ ],
9758
+ layout: {
9759
+ "text-field": "!",
9760
+ "text-font": ["Noto Sans Regular"],
9761
+ "text-size": 18,
9762
+ "text-allow-overlap": true,
9763
+ "text-ignore-placement": true
9764
+ },
9765
+ paint: {
9766
+ "text-color": "#ffffff",
9767
+ "text-halo-color": "rgba(0,0,0,0.45)",
9768
+ "text-halo-width": 1
9769
+ }
9770
+ });
9736
9771
  center_map(gobj);
9737
9772
  map.on("click", "clusters", async (e) => {
9738
9773
  const features = map.queryRenderedFeatures(e.point, { layers: ["clusters"] });
@@ -9678,7 +9678,20 @@ function load_devices(gobj) {
9678
9678
  source: "devices",
9679
9679
  filter: ["has", "point_count"],
9680
9680
  layout: {
9681
- "text-field": "{point_count_abbreviated}",
9681
+ "text-field": [
9682
+ "case",
9683
+ [
9684
+ "<",
9685
+ ["get", "connected"],
9686
+ ["get", "point_count"]
9687
+ ],
9688
+ [
9689
+ "concat",
9690
+ ["get", "point_count_abbreviated"],
9691
+ " !"
9692
+ ],
9693
+ ["get", "point_count_abbreviated"]
9694
+ ],
9682
9695
  "text-font": ["Noto Sans Regular"],
9683
9696
  "text-size": 14
9684
9697
  },
@@ -9728,6 +9741,28 @@ function load_devices(gobj) {
9728
9741
  "circle-stroke-color": "#fff"
9729
9742
  }
9730
9743
  });
9744
+ map.addLayer({
9745
+ id: "unclustered-alert",
9746
+ type: "symbol",
9747
+ source: "devices",
9748
+ filter: [
9749
+ "all",
9750
+ ["!", ["has", "point_count"]],
9751
+ ["!", ["get", "connected"]]
9752
+ ],
9753
+ layout: {
9754
+ "text-field": "!",
9755
+ "text-font": ["Noto Sans Regular"],
9756
+ "text-size": 18,
9757
+ "text-allow-overlap": true,
9758
+ "text-ignore-placement": true
9759
+ },
9760
+ paint: {
9761
+ "text-color": "#ffffff",
9762
+ "text-halo-color": "rgba(0,0,0,0.45)",
9763
+ "text-halo-width": 1
9764
+ }
9765
+ });
9731
9766
  center_map(gobj);
9732
9767
  map.on("click", "clusters", async (e) => {
9733
9768
  const features = map.queryRenderedFeatures(e.point, { layers: ["clusters"] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.97",
3
+ "version": "7.23.98",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
package/src/c_yui_map.js CHANGED
@@ -439,7 +439,15 @@ function load_devices(gobj)
439
439
  source: 'devices',
440
440
  filter: ['has', 'point_count'],
441
441
  layout: {
442
- 'text-field': '{point_count_abbreviated}',
442
+ /* The mark travels INSIDE the count, not as a second symbol
443
+ * layer on the same point: two symbols on one feature is a
444
+ * placement question (and the badge lost it), while a
445
+ * `concat` is just the label this cluster has. */
446
+ 'text-field': ['case',
447
+ ['<', ['get', 'connected'], ['get', 'point_count']],
448
+ ['concat', ['get', 'point_count_abbreviated'], ' !'],
449
+ ['get', 'point_count_abbreviated']
450
+ ],
443
451
  'text-font': ['Noto Sans Regular'],
444
452
  'text-size': 14
445
453
  },
@@ -504,6 +512,38 @@ function load_devices(gobj)
504
512
  }
505
513
  });
506
514
 
515
+ /* The state is a SHAPE too, and not only a colour.
516
+ *
517
+ * Connected and disconnected were told apart by green vs red
518
+ * alone -- in the circles as in the labels -- and that is the one
519
+ * pair colour blindness does not read; in greyscale the two discs
520
+ * are the same disc. A device that is DOWN carries an exclamation
521
+ * mark on it, and a CLUSTER with something down carries the same
522
+ * mark as a badge at its corner (its middle is taken by the
523
+ * count). One glyph, legible without colour at any zoom, drawn
524
+ * with the font the style already loads -- no image to fetch, so
525
+ * it works offline like the rest of the chapter.
526
+ *
527
+ * Added last, so they draw over the circles they mark. */
528
+ map.addLayer({
529
+ id: 'unclustered-alert',
530
+ type: 'symbol',
531
+ source: 'devices',
532
+ filter: ['all', ['!', ['has', 'point_count']], ['!', ['get', 'connected']]],
533
+ layout: {
534
+ 'text-field': '!',
535
+ 'text-font': ['Noto Sans Regular'],
536
+ 'text-size': 18,
537
+ 'text-allow-overlap': true,
538
+ 'text-ignore-placement': true
539
+ },
540
+ paint: {
541
+ 'text-color': '#ffffff',
542
+ 'text-halo-color': 'rgba(0,0,0,0.45)',
543
+ 'text-halo-width': 1
544
+ }
545
+ });
546
+
507
547
  center_map(gobj);
508
548
 
509
549
  // inspect a cluster on click