@yuneta/gobj-ui 1.0.1 → 1.0.3
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/dist/gobj-ui.cjs.js +754 -548
- package/dist/gobj-ui.es.js +754 -548
- package/package.json +1 -1
- package/src/c_yui_map.js +30 -5
package/package.json
CHANGED
package/src/c_yui_map.js
CHANGED
|
@@ -305,7 +305,7 @@ function get_coordinates(gobj, device)
|
|
|
305
305
|
* Coordinates can be set in device.settings or in device
|
|
306
306
|
* If devices.settings are null then get it from device
|
|
307
307
|
*/
|
|
308
|
-
let coordinates = decod_coordinates(gobj, device.settings
|
|
308
|
+
let coordinates = decod_coordinates(gobj, device.settings?.coordinates);
|
|
309
309
|
if(coordinates.lng === 0 && coordinates.lat === 0) {
|
|
310
310
|
coordinates = decod_coordinates(gobj, device.coordinates);
|
|
311
311
|
}
|
|
@@ -381,7 +381,18 @@ function devices2geojson(gobj, devices)
|
|
|
381
381
|
id: device.id,
|
|
382
382
|
name: device.name,
|
|
383
383
|
image: device.image,
|
|
384
|
-
|
|
384
|
+
/*
|
|
385
|
+
* A REAL boolean. Four style expressions test this with
|
|
386
|
+
* ['case', ...], and maplibre asserts a STRICT boolean
|
|
387
|
+
* there, so null, absent, or the 1/0 a backend may send all
|
|
388
|
+
* fail the assertion. The consequences are not cosmetic:
|
|
389
|
+
* the point paints with the property default instead of
|
|
390
|
+
* green/red, and the cluster accumulator turns NULL, which
|
|
391
|
+
* the cluster colour compares against point_count -- never
|
|
392
|
+
* equal, so the whole cluster stays red as if something were
|
|
393
|
+
* disconnected.
|
|
394
|
+
*/
|
|
395
|
+
connected: !!device.connected,
|
|
385
396
|
gobj_service_name: device.gobj_service_name,
|
|
386
397
|
}
|
|
387
398
|
};
|
|
@@ -776,10 +787,24 @@ function ac_refresh(gobj, event, kw, src)
|
|
|
776
787
|
let devices = gobj_read_attr(gobj, "devices");
|
|
777
788
|
|
|
778
789
|
let map = priv.xmap;
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
790
|
+
|
|
791
|
+
/*
|
|
792
|
+
* Ask for the source, do not infer it from the style. 'devices' is added
|
|
793
|
+
* by load_devices() on the map 'load' event, which is a LATER milestone:
|
|
794
|
+
* isStyleLoaded() is already true one render frame before 'load' fires,
|
|
795
|
+
* and getSource() is undefined in that frame. Nothing is lost by
|
|
796
|
+
* skipping, load_devices() reads the same attr.
|
|
797
|
+
*
|
|
798
|
+
* Testing the style was also wrong the other way: it goes back to false
|
|
799
|
+
* while new tiles load, so every refresh during a pan or a zoom was
|
|
800
|
+
* silently dropped and the devices stopped moving.
|
|
801
|
+
*/
|
|
802
|
+
const source = map.getSource('devices');
|
|
803
|
+
if(!source) {
|
|
804
|
+
return 0;
|
|
782
805
|
}
|
|
806
|
+
|
|
807
|
+
source.setData(devices2geojson(gobj, devices));
|
|
783
808
|
return 0;
|
|
784
809
|
}
|
|
785
810
|
|