bruce-cesium 7.8.5 → 7.8.7
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/bruce-cesium.es5.js +141 -10
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +139 -8
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label-group.js +93 -4
- package/dist/lib/rendering/render-managers/common/entity-label-group.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label.js +13 -3
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +32 -0
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/common/entity-label-group.d.ts +21 -1
- package/dist/types/rendering/render-managers/common/entity-label.d.ts +1 -0
- package/dist/types/rendering/visuals-register.d.ts +5 -0
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -9670,6 +9670,11 @@
|
|
|
9670
9670
|
if (!entityIds.length) {
|
|
9671
9671
|
return;
|
|
9672
9672
|
}
|
|
9673
|
+
if (this.options.reportClick) {
|
|
9674
|
+
const keys = event;
|
|
9675
|
+
this.visualRegister.ClickLabelEntities(entityIds, Boolean(keys.ctrlKey || keys.metaKey || keys.shiftKey));
|
|
9676
|
+
return;
|
|
9677
|
+
}
|
|
9673
9678
|
this.visualRegister.ClearSelected({ requestRender: false });
|
|
9674
9679
|
this.visualRegister.SetSelected({ entityIds, selected: true });
|
|
9675
9680
|
};
|
|
@@ -10340,7 +10345,7 @@
|
|
|
10340
10345
|
let displacement = { x: 0, y: 0 };
|
|
10341
10346
|
let nudge = { x: 0, y: 0, fromX: 0, fromY: 0, targetX: 0, targetY: 0, start: 0 };
|
|
10342
10347
|
const apply = (placement) => {
|
|
10343
|
-
var _a, _b, _c, _d, _e;
|
|
10348
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10344
10349
|
const show = (placement === null || placement === void 0 ? void 0 : placement.visible) && placement.opacity > 0;
|
|
10345
10350
|
if (!show && hiddenLast) {
|
|
10346
10351
|
return;
|
|
@@ -10401,6 +10406,11 @@
|
|
|
10401
10406
|
ele.style.opacity = String(opacity);
|
|
10402
10407
|
ele.style.zIndex = String(placement.zIndex);
|
|
10403
10408
|
ele.dataset.clusterCount = String(placement.members.length || 1);
|
|
10409
|
+
// Every Entity a cluster stands for, so a box selection takes them all, not only the one drawn.
|
|
10410
|
+
const clusterIds = placement.members.length ? placement.entityIds.join(" ") : "";
|
|
10411
|
+
if (((_d = ele.dataset.clusterIds) !== null && _d !== void 0 ? _d : "") !== clusterIds) {
|
|
10412
|
+
ele.dataset.clusterIds = clusterIds;
|
|
10413
|
+
}
|
|
10404
10414
|
countElement.style.display = placement.members.length ? "block" : "none";
|
|
10405
10415
|
countElement.style.order = placement.textSide === "left" ? "-1" : "0";
|
|
10406
10416
|
const count = placement.members.length ? String(placement.members.length) : "";
|
|
@@ -10413,9 +10423,9 @@
|
|
|
10413
10423
|
const stack = JSON.stringify(placement.icons || []);
|
|
10414
10424
|
if (iconStack && stack !== displayedStack) {
|
|
10415
10425
|
displayedStack = stack;
|
|
10416
|
-
const looks = ((
|
|
10426
|
+
const looks = ((_e = placement.icons) === null || _e === void 0 ? void 0 : _e.length) ? [iconLook(this.options), ...placement.icons] : [];
|
|
10417
10427
|
// One small size for all, so no icon in the arrangement reads as more important than another.
|
|
10418
|
-
const size = (this.options.iconSize || 24) * ((
|
|
10428
|
+
const size = (this.options.iconSize || 24) * ((_f = this.options.iconScale) !== null && _f !== void 0 ? _f : 1) * ICON_STACK_SCALE;
|
|
10419
10429
|
const built = looks.map(look => this.buildIcon({ ...(pin ? pinLook(look) : look), iconSize: size }, counter));
|
|
10420
10430
|
// A stack is on show already, so its photos load straight away.
|
|
10421
10431
|
built.forEach(({ start }) => start === null || start === void 0 ? void 0 : start());
|
|
@@ -11172,6 +11182,35 @@
|
|
|
11172
11182
|
})(exports.EntityLabel || (exports.EntityLabel = {}));
|
|
11173
11183
|
|
|
11174
11184
|
(function (EntityLabelGroup) {
|
|
11185
|
+
// Prefixes that make an icon value name its kind, so one mapping can send Entities to icons of different kinds.
|
|
11186
|
+
EntityLabelGroup.ICON_PREFIX = {
|
|
11187
|
+
// A Font Awesome class, "FA:fas fa-cube".
|
|
11188
|
+
FontAwesome: "FA:",
|
|
11189
|
+
// A client file by id, or an image by URL, "CF:<file id or URL>".
|
|
11190
|
+
ClientFile: "CF:"
|
|
11191
|
+
};
|
|
11192
|
+
/*
|
|
11193
|
+
* The icon a prefixed value names, as a class or an image URL, or null for a value with no known prefix.
|
|
11194
|
+
*/
|
|
11195
|
+
function ParseIcon(value, api) {
|
|
11196
|
+
if (typeof value !== "string") {
|
|
11197
|
+
return null;
|
|
11198
|
+
}
|
|
11199
|
+
const named = value.trim();
|
|
11200
|
+
if (named.startsWith(EntityLabelGroup.ICON_PREFIX.FontAwesome)) {
|
|
11201
|
+
const iconClass = named.slice(EntityLabelGroup.ICON_PREFIX.FontAwesome.length).trim();
|
|
11202
|
+
return iconClass ? { iconClass } : null;
|
|
11203
|
+
}
|
|
11204
|
+
if (named.startsWith(EntityLabelGroup.ICON_PREFIX.ClientFile)) {
|
|
11205
|
+
const file = named.slice(EntityLabelGroup.ICON_PREFIX.ClientFile.length).trim();
|
|
11206
|
+
if (!file) {
|
|
11207
|
+
return null;
|
|
11208
|
+
}
|
|
11209
|
+
return { iconUrl: /^[a-z][a-z0-9+.-]*:/i.test(file) ? file : BModels.ClientFile.GetUrl({ api, fileId: file, viaCdn: true }) };
|
|
11210
|
+
}
|
|
11211
|
+
return null;
|
|
11212
|
+
}
|
|
11213
|
+
EntityLabelGroup.ParseIcon = ParseIcon;
|
|
11175
11214
|
// The glow a selected place is drawn with.
|
|
11176
11215
|
const PLACE_SELECTED_COLOR = "#33B1FF";
|
|
11177
11216
|
// Keys places share the entity bookkeeping under, scoped to their group so a copied group keeps its own.
|
|
@@ -11395,6 +11434,10 @@
|
|
|
11395
11434
|
this.imagesAsking = new Set();
|
|
11396
11435
|
this.imagesTimer = null;
|
|
11397
11436
|
this.placesInteractive = false;
|
|
11437
|
+
// Whether a click on an Entity label is reported to the app instead of selecting the Entity.
|
|
11438
|
+
this.entitiesInteractive = false;
|
|
11439
|
+
// The Entity labels the app has picked, by group, drawn with the same glow as a picked place.
|
|
11440
|
+
this.selectedEntities = new Map();
|
|
11398
11441
|
}
|
|
11399
11442
|
notify() {
|
|
11400
11443
|
try {
|
|
@@ -11597,6 +11640,42 @@
|
|
|
11597
11640
|
}
|
|
11598
11641
|
this.refresh(keys);
|
|
11599
11642
|
}
|
|
11643
|
+
/*
|
|
11644
|
+
* Whether a click on an Entity label is reported to the app rather than selecting its Entity.
|
|
11645
|
+
*/
|
|
11646
|
+
SetEntitiesInteractive(on) {
|
|
11647
|
+
if (this.entitiesInteractive === on) {
|
|
11648
|
+
return;
|
|
11649
|
+
}
|
|
11650
|
+
this.entitiesInteractive = on;
|
|
11651
|
+
const keys = new Set();
|
|
11652
|
+
for (const group of this.active.values()) {
|
|
11653
|
+
for (const [key, item] of group.items) {
|
|
11654
|
+
if (!item.placeId) {
|
|
11655
|
+
keys.add(key);
|
|
11656
|
+
}
|
|
11657
|
+
}
|
|
11658
|
+
}
|
|
11659
|
+
this.refresh(keys);
|
|
11660
|
+
}
|
|
11661
|
+
/*
|
|
11662
|
+
* Replaces which of a group's Entity labels glow as picked, redrawing only those that changed.
|
|
11663
|
+
*/
|
|
11664
|
+
SetSelectedEntities(id, entityIds) {
|
|
11665
|
+
var _a;
|
|
11666
|
+
const before = (_a = this.selectedEntities.get(id)) !== null && _a !== void 0 ? _a : new Set();
|
|
11667
|
+
const after = new Set((entityIds !== null && entityIds !== void 0 ? entityIds : []).filter(key => typeof key === "string" && key && !IsPlaceKey(key)));
|
|
11668
|
+
const changed = new Set([...before, ...after].filter(key => before.has(key) !== after.has(key)));
|
|
11669
|
+
if (after.size) {
|
|
11670
|
+
this.selectedEntities.set(id, after);
|
|
11671
|
+
}
|
|
11672
|
+
else {
|
|
11673
|
+
this.selectedEntities.delete(id);
|
|
11674
|
+
}
|
|
11675
|
+
if (changed.size && this.active.has(id)) {
|
|
11676
|
+
this.refresh(changed);
|
|
11677
|
+
}
|
|
11678
|
+
}
|
|
11600
11679
|
Get() {
|
|
11601
11680
|
return Array.from(this.definitions.keys(), id => {
|
|
11602
11681
|
var _a;
|
|
@@ -11647,7 +11726,7 @@
|
|
|
11647
11726
|
* One member's label settings, with any image its own text links to but before its default image.
|
|
11648
11727
|
*/
|
|
11649
11728
|
compose(group, entityId, menuItemId) {
|
|
11650
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
11729
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
11651
11730
|
const item = group.items.get(entityId);
|
|
11652
11731
|
const entity = (_a = item.entity) !== null && _a !== void 0 ? _a : { Bruce: { ID: entityId, Name: item.text } };
|
|
11653
11732
|
let iconPriority = (_b = group.definition.options) === null || _b === void 0 ? void 0 : _b.iconPriority;
|
|
@@ -11698,6 +11777,20 @@
|
|
|
11698
11777
|
iconPriority: Number.isFinite(iconPriority) ? iconPriority : item.iconPriority,
|
|
11699
11778
|
iconStatus: (_p = resolveIcon((_o = group.definition.options) === null || _o === void 0 ? void 0 : _o.iconStatus, entity)) !== null && _p !== void 0 ? _p : item.iconStatus
|
|
11700
11779
|
};
|
|
11780
|
+
// A prefixed icon names its kind and replaces the group's others; an unprefixed one stays the glyph it was.
|
|
11781
|
+
const named = ParseIcon(options.icon, (_q = this.register.ApiGetters) === null || _q === void 0 ? void 0 : _q.GetBruceApi());
|
|
11782
|
+
if (named) {
|
|
11783
|
+
options.icon = undefined;
|
|
11784
|
+
options.iconClass = named.iconClass;
|
|
11785
|
+
options.iconUrl = named.iconUrl;
|
|
11786
|
+
}
|
|
11787
|
+
if (!item.placeId && this.entitiesInteractive) {
|
|
11788
|
+
options.selectOnClick = true;
|
|
11789
|
+
options.reportClick = true;
|
|
11790
|
+
}
|
|
11791
|
+
if (!item.placeId && ((_r = this.selectedEntities.get(group.definition.id)) === null || _r === void 0 ? void 0 : _r.has(entityId))) {
|
|
11792
|
+
options.highlightColor = PLACE_SELECTED_COLOR;
|
|
11793
|
+
}
|
|
11701
11794
|
if (item.placeId) {
|
|
11702
11795
|
// Clickable only when the app asks, and reported then, as there is no Entity to select.
|
|
11703
11796
|
options.selectOnClick = this.placesInteractive;
|
|
@@ -11708,16 +11801,19 @@
|
|
|
11708
11801
|
options.iconUrl = look.iconUrl || undefined;
|
|
11709
11802
|
options.iconClass = look.iconUrl ? undefined : look.iconClass;
|
|
11710
11803
|
}
|
|
11711
|
-
if (look === null || look === void 0 ? void 0 : look.iconColor) {
|
|
11712
|
-
options.iconColor = look.iconColor;
|
|
11804
|
+
if ((look === null || look === void 0 ? void 0 : look.iconColor) != null) {
|
|
11805
|
+
options.iconColor = look.iconColor || undefined;
|
|
11713
11806
|
}
|
|
11714
11807
|
if ((look === null || look === void 0 ? void 0 : look.iconBackground) != null) {
|
|
11715
11808
|
options.iconBackground = look.iconBackground;
|
|
11716
11809
|
}
|
|
11810
|
+
if ((look === null || look === void 0 ? void 0 : look.iconScale) > 0) {
|
|
11811
|
+
options.iconScale = look.iconScale;
|
|
11812
|
+
}
|
|
11717
11813
|
}
|
|
11718
11814
|
if (options.attributes && item.entity && !(expression && resolvedText != null)) {
|
|
11719
11815
|
options.text = [
|
|
11720
|
-
(
|
|
11816
|
+
(_u = (_s = options.text) !== null && _s !== void 0 ? _s : (_t = item.entity.Bruce) === null || _t === void 0 ? void 0 : _t.Name) !== null && _u !== void 0 ? _u : entityId,
|
|
11721
11817
|
...options.attributes.map(path => BModels.Entity.GetValue({ entity: item.entity, path })).filter(value => value != null).map(String)
|
|
11722
11818
|
].join("\n");
|
|
11723
11819
|
}
|
|
@@ -11879,6 +11975,7 @@
|
|
|
11879
11975
|
Remove(id) {
|
|
11880
11976
|
var _a;
|
|
11881
11977
|
const known = this.definitions.delete(id);
|
|
11978
|
+
this.selectedEntities.delete(id);
|
|
11882
11979
|
this.visibility.delete(id);
|
|
11883
11980
|
this.errors.delete(id);
|
|
11884
11981
|
(_a = this.pending.get(id)) === null || _a === void 0 ? void 0 : _a.abort();
|
|
@@ -11911,6 +12008,7 @@
|
|
|
11911
12008
|
this.active.clear();
|
|
11912
12009
|
this.members.clear();
|
|
11913
12010
|
this.definitions.clear();
|
|
12011
|
+
this.selectedEntities.clear();
|
|
11914
12012
|
this.visibility.clear();
|
|
11915
12013
|
this.errors.clear();
|
|
11916
12014
|
this.refresh(affected);
|
|
@@ -11930,6 +12028,7 @@
|
|
|
11930
12028
|
this.active.clear();
|
|
11931
12029
|
this.members.clear();
|
|
11932
12030
|
this.definitions.clear();
|
|
12031
|
+
this.selectedEntities.clear();
|
|
11933
12032
|
this.visibility.clear();
|
|
11934
12033
|
this.errors.clear();
|
|
11935
12034
|
}
|
|
@@ -13863,6 +13962,7 @@
|
|
|
13863
13962
|
}
|
|
13864
13963
|
get OnLabelGroupsChanged() { return this.labelGroupsChanged; }
|
|
13865
13964
|
get OnLabelPlaceClick() { return this.labelPlaceClicked; }
|
|
13965
|
+
get OnLabelEntityClick() { return this.labelEntityClicked; }
|
|
13866
13966
|
constructor(params) {
|
|
13867
13967
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
13868
13968
|
this.id = BModels.ObjectUtils.UId();
|
|
@@ -13917,6 +14017,7 @@
|
|
|
13917
14017
|
this.shadowsRemoval = null;
|
|
13918
14018
|
this.labelGroupsChanged = new BModels.BruceEvent();
|
|
13919
14019
|
this.labelPlaceClicked = new BModels.BruceEvent();
|
|
14020
|
+
this.labelEntityClicked = new BModels.BruceEvent();
|
|
13920
14021
|
this.hoverRingState = {};
|
|
13921
14022
|
this.retiringHoverLabels = new Map();
|
|
13922
14023
|
/*
|
|
@@ -14917,6 +15018,7 @@
|
|
|
14917
15018
|
(_c = this.labelGroups) === null || _c === void 0 ? void 0 : _c.Dispose();
|
|
14918
15019
|
this.labelGroupsChanged.Clear();
|
|
14919
15020
|
this.labelPlaceClicked.Clear();
|
|
15021
|
+
this.labelEntityClicked.Clear();
|
|
14920
15022
|
for (const regos of Object.values(this.rego)) {
|
|
14921
15023
|
for (const rego of regos)
|
|
14922
15024
|
exports.EntityLabel.Detatch({ rego, force: true });
|
|
@@ -16712,6 +16814,35 @@
|
|
|
16712
16814
|
this.labelPlaceClicked.Trigger({ places, additive });
|
|
16713
16815
|
}
|
|
16714
16816
|
}
|
|
16817
|
+
/*
|
|
16818
|
+
* Whether Entity label clicks go to OnLabelEntityClick rather than selecting. Off by default.
|
|
16819
|
+
*/
|
|
16820
|
+
SetLabelEntitiesInteractive(on) {
|
|
16821
|
+
if (this.disposed) {
|
|
16822
|
+
return;
|
|
16823
|
+
}
|
|
16824
|
+
if (!this.labelGroups) {
|
|
16825
|
+
this.labelGroups = new exports.EntityLabelGroup.Manager(this, () => this.labelGroupsChanged.Trigger(undefined));
|
|
16826
|
+
}
|
|
16827
|
+
this.labelGroups.SetEntitiesInteractive(on);
|
|
16828
|
+
}
|
|
16829
|
+
/*
|
|
16830
|
+
* Called by a label clicked while Entity labels are interactive, with the Entities it stands for.
|
|
16831
|
+
*/
|
|
16832
|
+
ClickLabelEntities(entityIds, additive) {
|
|
16833
|
+
const labels = entityIds.map(entityId => { var _a; return ({ groupId: (_a = this.GetLabelGroupFor(entityId)) === null || _a === void 0 ? void 0 : _a.groupId, entityId }); })
|
|
16834
|
+
.filter(label => label.groupId);
|
|
16835
|
+
if (labels.length) {
|
|
16836
|
+
this.labelEntityClicked.Trigger({ labels, additive });
|
|
16837
|
+
}
|
|
16838
|
+
}
|
|
16839
|
+
/*
|
|
16840
|
+
* Which of a group's Entity labels glow as picked by the app.
|
|
16841
|
+
*/
|
|
16842
|
+
SetLabelGroupSelected(id, entityIds) {
|
|
16843
|
+
var _a;
|
|
16844
|
+
(_a = this.labelGroups) === null || _a === void 0 ? void 0 : _a.SetSelectedEntities(id, entityIds);
|
|
16845
|
+
}
|
|
16715
16846
|
/*
|
|
16716
16847
|
* Replaces a group's places without reading its source again. False when no such group was set.
|
|
16717
16848
|
*/
|
|
@@ -60859,7 +60990,7 @@ void main() {
|
|
|
60859
60990
|
StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
|
|
60860
60991
|
})(exports.StyleUtils || (exports.StyleUtils = {}));
|
|
60861
60992
|
|
|
60862
|
-
const VERSION = "7.8.
|
|
60993
|
+
const VERSION = "7.8.7";
|
|
60863
60994
|
/**
|
|
60864
60995
|
* Updates the environment instance used by bruce-cesium to one specified.
|
|
60865
60996
|
* This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
|