bruce-cesium 3.2.4 → 3.2.6

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.
@@ -691,7 +691,7 @@
691
691
  })(exports.ViewUtils || (exports.ViewUtils = {}));
692
692
 
693
693
  /**
694
- * Returns if a given visual is alive and in the scene.
694
+ * Returns if a given visual can be styled by this utility.
695
695
  * @param viewer
696
696
  * @param visual
697
697
  * @returns
@@ -701,10 +701,10 @@
701
701
  return false;
702
702
  }
703
703
  if (visual instanceof Cesium.Entity) {
704
- return viewer.entities.contains(visual);
704
+ return true;
705
705
  }
706
706
  else if (visual instanceof Cesium.Primitive) {
707
- return viewer.scene.primitives.contains(visual);
707
+ return true;
708
708
  }
709
709
  else if (visual instanceof Cesium.Cesium3DTileFeature) {
710
710
  var cTileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
@@ -718,133 +718,589 @@
718
718
  }
719
719
  return false;
720
720
  }
721
- function traverseEntity(cEntity, arr, ignoreParent) {
722
- if (cEntity._parentEntity && !ignoreParent) {
723
- traverseEntity(cEntity._parentEntity, arr, false);
721
+ var _selectColor = Cesium.Color.fromAlpha(Cesium.Color.YELLOW, 0.5);
722
+ var _highlightColor = Cesium.Color.fromCssColorString("#33b1ff").withAlpha(0.5);
723
+ var STORE_COLOR_PREFIX = "_storeColor_";
724
+ function getStoreKey(key) {
725
+ return STORE_COLOR_PREFIX + key;
726
+ }
727
+ var STORE_KEY_STATE_PREFIX = "_storeKeyState_";
728
+ function getStoreStateKey(key) {
729
+ return STORE_KEY_STATE_PREFIX + key;
730
+ }
731
+ var LAST_APPLIED_OPACITY_KEY = "_lastAppliedOpacityKey";
732
+ /**
733
+ * Returns a color property from a graphic.
734
+ * This will turn materials properties into colors before returning them.
735
+ * @param viewer
736
+ * @param prop
737
+ * @returns
738
+ */
739
+ function getCesiumColorValue(viewer, prop) {
740
+ if (!prop) {
741
+ return Cesium.Color.WHITE;
724
742
  }
725
- if (cEntity._siblingGraphics) {
726
- for (var i = 0; i < cEntity._siblingGraphics.length; i++) {
727
- var sibling = cEntity._siblingGraphics[i];
728
- traverseEntity(sibling, arr, true);
729
- }
743
+ if (prop.getValue) {
744
+ prop = prop.getValue(viewer.scene.lastRenderTime);
730
745
  }
731
- arr.push(cEntity);
746
+ if (prop instanceof Cesium.Color) {
747
+ return prop;
748
+ }
749
+ var tmp = prop === null || prop === void 0 ? void 0 : prop.color;
750
+ if (tmp === null || tmp === void 0 ? void 0 : tmp.getValue) {
751
+ tmp = tmp.getValue(viewer.scene.lastRenderTime);
752
+ }
753
+ return tmp ? tmp : Cesium.Color.WHITE;
732
754
  }
733
- var ORG_OPACITY_KEY = "_org_opacity_";
734
- var NEW_OPACITY_KEY = "_new_opacity_";
735
- function getColor(viewer, material) {
736
- var _a, _b;
737
- function findColor() {
738
- if (!material) {
739
- return Cesium.Color.WHITE;
755
+ /**
756
+ * Returns the current color of a graphic.
757
+ * @param viewer
758
+ * @param graphic
759
+ * @returns
760
+ */
761
+ function calculateCurColor(viewer, graphic) {
762
+ var _a, _b, _c, _d, _e, _f, _g, _h;
763
+ var color;
764
+ if (graphic instanceof Cesium.Cesium3DTileFeature) {
765
+ color = (_a = graphic.color) !== null && _a !== void 0 ? _a : new Cesium.Color();
766
+ }
767
+ else if (graphic instanceof Cesium.ModelGraphics) {
768
+ color = (_b = getCesiumColorValue(viewer, graphic.color)) !== null && _b !== void 0 ? _b : new Cesium.Color();
769
+ }
770
+ else if (graphic instanceof Cesium.PolygonGraphics) {
771
+ color = (_c = getCesiumColorValue(viewer, graphic.material)) !== null && _c !== void 0 ? _c : new Cesium.Color();
772
+ }
773
+ else if (graphic instanceof Cesium.PolylineGraphics) {
774
+ color = (_d = getCesiumColorValue(viewer, graphic.material)) !== null && _d !== void 0 ? _d : new Cesium.Color();
775
+ }
776
+ else if (graphic instanceof Cesium.CorridorGraphics) {
777
+ color = (_e = getCesiumColorValue(viewer, graphic.material)) !== null && _e !== void 0 ? _e : new Cesium.Color();
778
+ }
779
+ else if (graphic instanceof Cesium.PointGraphics) {
780
+ color = (_f = getCesiumColorValue(viewer, graphic.color)) !== null && _f !== void 0 ? _f : new Cesium.Color();
781
+ }
782
+ else if (graphic instanceof Cesium.BillboardGraphics) {
783
+ color = (_g = getCesiumColorValue(viewer, graphic.color)) !== null && _g !== void 0 ? _g : new Cesium.Color();
784
+ }
785
+ else if (graphic instanceof Cesium.EllipseGraphics) {
786
+ color = (_h = getCesiumColorValue(viewer, graphic.material)) !== null && _h !== void 0 ? _h : new Cesium.Color();
787
+ }
788
+ return color;
789
+ }
790
+ /**
791
+ * Stores a copy of the color against a key within the graphic.
792
+ * This lets us refer to it later if we need to change to it.
793
+ * @param viewer
794
+ * @param key
795
+ * @param color
796
+ * @param graphic
797
+ */
798
+ function storeColor(viewer, key, color, graphic) {
799
+ graphic[getStoreKey(key)] = (color === null || color === void 0 ? void 0 : color.clone) ? color.clone() : color;
800
+ }
801
+ /**
802
+ * Returns a stored color for a graphic.
803
+ * If no color is stored, it will calculate and store the default color.
804
+ * @param viewer
805
+ * @param key
806
+ * @param graphic
807
+ * @returns
808
+ */
809
+ function getColor(viewer, key, graphic) {
810
+ var color = graphic[getStoreKey(key)];
811
+ // If no color is stored for the default color, we'll calculate and store it.
812
+ if (!color) {
813
+ if (key == "default") {
814
+ color = calculateCurColor(viewer, graphic);
740
815
  }
741
- if (material.getValue) {
742
- material = material.getValue(viewer.scene.lastRenderTime);
816
+ else if (key == "select") {
817
+ color = _selectColor;
743
818
  }
744
- if (material instanceof Cesium.Color) {
745
- return material;
819
+ else if (key == "highlight") {
820
+ color = _highlightColor;
746
821
  }
747
- var tmp = material === null || material === void 0 ? void 0 : material.color;
748
- if (tmp === null || tmp === void 0 ? void 0 : tmp.getValue) {
749
- tmp = tmp.getValue(viewer.scene.lastRenderTime);
822
+ if (color) {
823
+ storeColor(viewer, key, color, graphic);
750
824
  }
751
- return tmp ? tmp : Cesium.Color.WHITE;
752
- }
753
- return (_b = (_a = findColor()) === null || _a === void 0 ? void 0 : _a.clone) === null || _b === void 0 ? void 0 : _b.call(_a);
754
- }
755
- function applyOpacityToColor(viewer, opacity, material) {
756
- var color = getColor(viewer, material);
757
- if (color) {
758
- color.alpha = opacity;
759
825
  }
760
826
  return color;
761
827
  }
762
- function applyOpacityToGraphic(viewer, entity, graphicKey, materialKey, opacity) {
763
- var color = applyOpacityToColor(viewer, opacity, entity[graphicKey][materialKey]);
764
- if (color) {
765
- entity[graphicKey][materialKey] = materialKey == "material" ? new Cesium.ColorMaterialProperty(color) : color;
828
+ /**
829
+ * Applies opacity to current color.
830
+ * @param viewer
831
+ * @param opacity
832
+ * @param graphic
833
+ */
834
+ function applyOpacity(viewer, opacity, graphic) {
835
+ refreshColor(viewer, graphic, opacity);
836
+ }
837
+ /**
838
+ * Applies a color to a graphic based on the current key states.
839
+ * Eg: if the graphic is selected, it will apply the selected color.
840
+ * @param viewer
841
+ * @param graphic
842
+ * @param opacity
843
+ */
844
+ function refreshColor(viewer, graphic, opacity) {
845
+ var _a;
846
+ // Calculate what color key we should apply.
847
+ var key = "default";
848
+ if (getKeyState(graphic, "select")) {
849
+ key = "select";
850
+ }
851
+ else if (getKeyState(graphic, "highlight")) {
852
+ key = "highlight";
853
+ }
854
+ // This ensures that the default color is always stored prior to applying a new color.
855
+ if (key != "default") {
856
+ getColor(viewer, "default", graphic);
857
+ }
858
+ var color = (_a = getColor(viewer, key, graphic)) !== null && _a !== void 0 ? _a : Cesium.Color.WHITE;
859
+ // If we're highlighting and it's selected, don't change the color.
860
+ if (key != "highlight" || getKeyState(graphic, "select") == false) {
861
+ color = color.clone();
862
+ // Multiply opacity if one is set.
863
+ if (opacity != null) {
864
+ // Not sure if this will ever be needed.
865
+ // The original code had a null-check but I suspect it was because it may not been a Cesium color instance.
866
+ if (color.alpha == null) {
867
+ color.alpha = 1;
868
+ }
869
+ color.alpha *= opacity;
870
+ // Cesium ignores pure white so if we want opacity and it's white, we'll set a tiny blue value.
871
+ if (color.equals(Cesium.Color.WHITE)) {
872
+ color.blue = 0.0001;
873
+ }
874
+ }
875
+ if (graphic instanceof Cesium.Cesium3DTileFeature) {
876
+ graphic.color = color;
877
+ }
878
+ else if (graphic instanceof Cesium.ModelGraphics) {
879
+ graphic.color = color;
880
+ }
881
+ else if (graphic instanceof Cesium.PolygonGraphics) {
882
+ graphic.material = new Cesium.ColorMaterialProperty(color);
883
+ }
884
+ else if (graphic instanceof Cesium.PolylineGraphics) {
885
+ graphic.material = new Cesium.ColorMaterialProperty(color);
886
+ }
887
+ else if (graphic instanceof Cesium.CorridorGraphics) {
888
+ graphic.material = new Cesium.ColorMaterialProperty(color);
889
+ }
890
+ else if (graphic instanceof Cesium.PointGraphics) {
891
+ graphic.color = color;
892
+ }
893
+ else if (graphic instanceof Cesium.BillboardGraphics) {
894
+ graphic.color = color;
895
+ }
896
+ else if (graphic instanceof Cesium.EllipseGraphics) {
897
+ graphic.material = new Cesium.ColorMaterialProperty(color);
898
+ }
899
+ graphic[LAST_APPLIED_OPACITY_KEY] = opacity;
900
+ }
901
+ // Record the state of the current key.
902
+ graphic[getStoreStateKey(key)] = true;
903
+ // This means other keys are false.
904
+ if (key == "default") {
905
+ graphic[getStoreStateKey("select")] = false;
906
+ graphic[getStoreStateKey("highlight")] = false;
907
+ }
908
+ // This means 'default' is false.
909
+ else {
910
+ graphic[getStoreStateKey("default")] = false;
766
911
  }
767
912
  }
768
- function revertAppliedEntityOpacity(viewer, entity) {
769
- if (!isAlive(viewer, entity)) {
770
- return;
913
+ /**
914
+ * Returns the last applied opacity for a graphic.
915
+ * This is used to ensure that we don't lose the opacity when we change color.
916
+ * @param graphic
917
+ * @returns
918
+ */
919
+ function getAppliedOpacity(graphic) {
920
+ return isNaN(graphic[LAST_APPLIED_OPACITY_KEY]) ? null : graphic[LAST_APPLIED_OPACITY_KEY];
921
+ }
922
+ /**
923
+ * Returns the state of a key for a graphic.
924
+ * Eg: if the graphic is selected, this will return true for the select key.
925
+ * A graphic may have multiple active states, but only one color can be applied at a time.
926
+ * @param graphic
927
+ * @param key
928
+ * @returns
929
+ */
930
+ function getKeyState(graphic, key) {
931
+ var value = graphic[getStoreStateKey(key)];
932
+ return value == null ? false : value;
933
+ }
934
+ /**
935
+ * Internal utility to help with managing Cesium Entity styling.
936
+ * Do not expose this to public as it will likely be killed and replaced with something that do animated changes.
937
+ */
938
+ var CesiumEntityStyler;
939
+ (function (CesiumEntityStyler) {
940
+ function UpdateColorSetting(key, color) {
941
+ if (key == "select") {
942
+ _selectColor = color.clone();
943
+ }
944
+ else if (key == "highlight") {
945
+ _highlightColor = color.clone();
946
+ }
947
+ }
948
+ CesiumEntityStyler.UpdateColorSetting = UpdateColorSetting;
949
+ /**
950
+ * Updates the opacity of the graphic.
951
+ * This will multiply against the current colour's opacity before applying.
952
+ * @param params
953
+ * @returns
954
+ */
955
+ function SetOpacity(params) {
956
+ var viewer = params.viewer, entity = params.entity, opacity = params.opacity, requestRender = params.requestRender;
957
+ if (!entity) {
958
+ return;
959
+ }
960
+ var parts = exports.EntityUtils.GatherEntity({
961
+ entity: entity
962
+ });
963
+ for (var i = 0; i < parts.length; i++) {
964
+ var part = parts[i];
965
+ if (!isAlive(viewer, part)) {
966
+ continue;
967
+ }
968
+ if (part instanceof Cesium.Cesium3DTileFeature) {
969
+ applyOpacity(viewer, opacity, part);
970
+ }
971
+ else if (part instanceof Cesium.Entity) {
972
+ if (part.billboard) {
973
+ applyOpacity(viewer, opacity, part.billboard);
974
+ }
975
+ if (part.model) {
976
+ applyOpacity(viewer, opacity, part.model);
977
+ }
978
+ if (part.polyline) {
979
+ applyOpacity(viewer, opacity, part.polyline);
980
+ }
981
+ if (part.polygon) {
982
+ applyOpacity(viewer, opacity, part.polygon);
983
+ }
984
+ if (part.corridor) {
985
+ applyOpacity(viewer, opacity, part.corridor);
986
+ }
987
+ if (part.point) {
988
+ applyOpacity(viewer, opacity, part.point);
989
+ }
990
+ if (part.ellipse) {
991
+ applyOpacity(viewer, opacity, part.ellipse);
992
+ }
993
+ }
994
+ }
995
+ if (requestRender != false) {
996
+ viewer.scene.requestRender();
997
+ }
771
998
  }
772
- entity[NEW_OPACITY_KEY] = null;
773
- if (entity instanceof Cesium.Entity) {
774
- var processKey = function (graphicKey, materialKey) {
775
- if (materialKey === void 0) { materialKey = "material"; }
776
- if (entity[graphicKey]) {
777
- var orgOpacity = entity[graphicKey][ORG_OPACITY_KEY];
778
- if (orgOpacity != null) {
779
- applyOpacityToGraphic(viewer, entity, graphicKey, materialKey, orgOpacity);
999
+ CesiumEntityStyler.SetOpacity = SetOpacity;
1000
+ /**
1001
+ * Returns the opacity of a graphic.
1002
+ * This will return the last applied opacity. If no opacity has been applied, it will return null.
1003
+ * @param params
1004
+ */
1005
+ function GetOpacity(params) {
1006
+ var entity = params.entity;
1007
+ if (!entity) {
1008
+ return null;
1009
+ }
1010
+ var parts = exports.EntityUtils.GatherEntity({
1011
+ entity: entity
1012
+ });
1013
+ for (var i = 0; i < parts.length; i++) {
1014
+ var part = parts[i];
1015
+ if (part instanceof Cesium.Cesium3DTileFeature) {
1016
+ return getAppliedOpacity(part);
1017
+ }
1018
+ else if (part instanceof Cesium.Entity) {
1019
+ if (part.billboard) {
1020
+ return getAppliedOpacity(part.billboard);
1021
+ }
1022
+ if (part.model) {
1023
+ return getAppliedOpacity(part.model);
1024
+ }
1025
+ if (part.polyline) {
1026
+ return getAppliedOpacity(part.polyline);
1027
+ }
1028
+ if (part.polygon) {
1029
+ return getAppliedOpacity(part.polygon);
1030
+ }
1031
+ if (part.corridor) {
1032
+ return getAppliedOpacity(part.corridor);
1033
+ }
1034
+ if (part.point) {
1035
+ return getAppliedOpacity(part.point);
1036
+ }
1037
+ if (part.ellipse) {
1038
+ return getAppliedOpacity(part.ellipse);
780
1039
  }
781
- entity[graphicKey][ORG_OPACITY_KEY] = null;
782
1040
  }
783
- };
784
- processKey("polygon");
785
- processKey("polyline");
786
- processKey("point", "color");
787
- processKey("ellipse");
788
- processKey("model", "color");
789
- processKey("corridor");
790
- processKey("billboard", "color");
791
- }
792
- else if (entity instanceof Cesium.Cesium3DTileFeature) {
793
- var orgOpacity = entity[ORG_OPACITY_KEY];
794
- if (orgOpacity != null) {
795
- var color = entity.color ? entity.color.clone() : new Cesium.Color();
796
- color.alpha = orgOpacity;
797
- entity.color = color;
798
- }
799
- entity[ORG_OPACITY_KEY] = null;
1041
+ }
1042
+ return null;
800
1043
  }
801
- }
802
- function applyOpacityToEntity(viewer, opacity, entity) {
803
- if (!isAlive(viewer, entity)) {
804
- return;
1044
+ CesiumEntityStyler.GetOpacity = GetOpacity;
1045
+ /**
1046
+ * Clears the opacity from a graphic and refreshes it.
1047
+ * Eg: if it is selected it will change the color to the selected color with the original selection opacity.
1048
+ * @param params
1049
+ */
1050
+ function ClearOpacity(params) {
1051
+ SetOpacity({
1052
+ viewer: params.viewer,
1053
+ entity: params.entity,
1054
+ opacity: null,
1055
+ requestRender: params.requestRender
1056
+ });
805
1057
  }
806
- entity[NEW_OPACITY_KEY] = opacity;
807
- if (entity instanceof Cesium.Entity) {
808
- var processKey = function (graphicKey, materialKey) {
809
- var _a;
810
- if (materialKey === void 0) { materialKey = "material"; }
811
- if (entity[graphicKey]) {
812
- var orgOpacity = entity[graphicKey][ORG_OPACITY_KEY];
813
- if (orgOpacity == null) {
814
- entity[graphicKey][ORG_OPACITY_KEY] = (_a = getColor(viewer, entity[graphicKey][materialKey])) === null || _a === void 0 ? void 0 : _a.alpha;
1058
+ CesiumEntityStyler.ClearOpacity = ClearOpacity;
1059
+ /**
1060
+ * Selects a graphic and refreshes it.
1061
+ * @param params
1062
+ */
1063
+ function Select(params) {
1064
+ var viewer = params.viewer, entity = params.entity, requestRender = params.requestRender;
1065
+ if (!entity) {
1066
+ return;
1067
+ }
1068
+ var parts = exports.EntityUtils.GatherEntity({
1069
+ entity: entity
1070
+ });
1071
+ for (var i = 0; i < parts.length; i++) {
1072
+ var part = parts[i];
1073
+ if (!isAlive(viewer, part)) {
1074
+ continue;
1075
+ }
1076
+ if (part instanceof Cesium.Cesium3DTileFeature) {
1077
+ var opacity = getAppliedOpacity(part);
1078
+ part[getStoreStateKey("select")] = true;
1079
+ refreshColor(viewer, part, opacity);
1080
+ }
1081
+ else if (part instanceof Cesium.Entity) {
1082
+ if (part.billboard) {
1083
+ part.billboard[getStoreStateKey("select")] = true;
1084
+ refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
815
1085
  }
816
- if (orgOpacity == null) {
817
- orgOpacity = 1;
1086
+ if (part.model) {
1087
+ part.model[getStoreStateKey("select")] = true;
1088
+ refreshColor(viewer, part.model, getAppliedOpacity(part.model));
1089
+ }
1090
+ if (part.polyline) {
1091
+ part.polyline[getStoreStateKey("select")] = true;
1092
+ refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
1093
+ }
1094
+ if (part.polygon) {
1095
+ part.polygon[getStoreStateKey("select")] = true;
1096
+ refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
1097
+ }
1098
+ if (part.corridor) {
1099
+ part.corridor[getStoreStateKey("select")] = true;
1100
+ refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
1101
+ }
1102
+ if (part.point) {
1103
+ part.point[getStoreStateKey("select")] = true;
1104
+ refreshColor(viewer, part.point, getAppliedOpacity(part.point));
1105
+ }
1106
+ if (part.ellipse) {
1107
+ part.ellipse[getStoreStateKey("select")] = true;
1108
+ refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
818
1109
  }
819
- applyOpacityToGraphic(viewer, entity, graphicKey, materialKey, opacity * orgOpacity);
820
1110
  }
821
- };
822
- processKey("polygon");
823
- processKey("polyline");
824
- processKey("point", "color");
825
- processKey("ellipse");
826
- processKey("model", "color");
827
- processKey("corridor");
828
- processKey("billboard", "color");
1111
+ }
1112
+ if (requestRender != false) {
1113
+ viewer.scene.requestRender();
1114
+ }
829
1115
  }
830
- else if (entity instanceof Cesium.Cesium3DTileFeature) {
831
- var orgOpacity = entity[ORG_OPACITY_KEY];
832
- if (orgOpacity == null) {
833
- entity[ORG_OPACITY_KEY] = entity.color ? entity.color.alpha : 1;
1116
+ CesiumEntityStyler.Select = Select;
1117
+ /**
1118
+ * Deselects a graphic and refreshes it.
1119
+ * If the graphic is highlighted, it will change the color to the highlighted color.
1120
+ * @param params
1121
+ */
1122
+ function Deselect(params) {
1123
+ var viewer = params.viewer, entity = params.entity, requestRender = params.requestRender;
1124
+ if (!entity) {
1125
+ return;
834
1126
  }
835
- if (!orgOpacity) {
836
- orgOpacity = 1;
1127
+ var parts = exports.EntityUtils.GatherEntity({
1128
+ entity: entity
1129
+ });
1130
+ for (var i = 0; i < parts.length; i++) {
1131
+ var part = parts[i];
1132
+ if (!isAlive(viewer, part)) {
1133
+ continue;
1134
+ }
1135
+ if (part instanceof Cesium.Cesium3DTileFeature) {
1136
+ var opacity = getAppliedOpacity(part);
1137
+ part[getStoreStateKey("select")] = false;
1138
+ refreshColor(viewer, part, opacity);
1139
+ }
1140
+ else if (part instanceof Cesium.Entity) {
1141
+ if (part.billboard) {
1142
+ part.billboard[getStoreStateKey("select")] = false;
1143
+ refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
1144
+ }
1145
+ if (part.model) {
1146
+ part.model[getStoreStateKey("select")] = false;
1147
+ refreshColor(viewer, part.model, getAppliedOpacity(part.model));
1148
+ }
1149
+ if (part.polyline) {
1150
+ part.polyline[getStoreStateKey("select")] = false;
1151
+ refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
1152
+ }
1153
+ if (part.polygon) {
1154
+ part.polygon[getStoreStateKey("select")] = false;
1155
+ refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
1156
+ }
1157
+ if (part.corridor) {
1158
+ part.corridor[getStoreStateKey("select")] = false;
1159
+ refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
1160
+ }
1161
+ if (part.point) {
1162
+ part.point[getStoreStateKey("select")] = false;
1163
+ refreshColor(viewer, part.point, getAppliedOpacity(part.point));
1164
+ }
1165
+ if (part.ellipse) {
1166
+ part.ellipse[getStoreStateKey("select")] = false;
1167
+ refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
1168
+ }
1169
+ }
837
1170
  }
838
- var color = entity.color ? entity.color.clone() : new Cesium.Color();
839
- color.alpha = opacity * orgOpacity;
840
- if (color.equals(Cesium.Color.WHITE)) {
841
- color.blue = 0.0001;
1171
+ if (requestRender != false) {
1172
+ viewer.scene.requestRender();
842
1173
  }
843
- entity.color = color;
844
1174
  }
845
- }
846
- function findOpacity(entity) {
847
- return entity ? entity[NEW_OPACITY_KEY] : null;
1175
+ CesiumEntityStyler.Deselect = Deselect;
1176
+ /**
1177
+ * Highlights a graphic and refreshes it.
1178
+ * If the graphic is selected, it will not change the color.
1179
+ * @param params
1180
+ */
1181
+ function Highlight(params) {
1182
+ var viewer = params.viewer, entity = params.entity, requestRender = params.requestRender;
1183
+ if (!entity) {
1184
+ return;
1185
+ }
1186
+ var parts = exports.EntityUtils.GatherEntity({
1187
+ entity: entity
1188
+ });
1189
+ for (var i = 0; i < parts.length; i++) {
1190
+ var part = parts[i];
1191
+ if (!isAlive(viewer, part)) {
1192
+ continue;
1193
+ }
1194
+ if (part instanceof Cesium.Cesium3DTileFeature) {
1195
+ part[getStoreStateKey("highlight")] = true;
1196
+ refreshColor(viewer, part, getAppliedOpacity(part));
1197
+ }
1198
+ else if (part instanceof Cesium.Entity) {
1199
+ if (part.billboard) {
1200
+ part.billboard[getStoreStateKey("highlight")] = true;
1201
+ refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
1202
+ }
1203
+ if (part.model) {
1204
+ part.model[getStoreStateKey("highlight")] = true;
1205
+ refreshColor(viewer, part.model, getAppliedOpacity(part.model));
1206
+ }
1207
+ if (part.polyline) {
1208
+ part.polyline[getStoreStateKey("highlight")] = true;
1209
+ refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
1210
+ }
1211
+ if (part.polygon) {
1212
+ part.polygon[getStoreStateKey("highlight")] = true;
1213
+ refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
1214
+ }
1215
+ if (part.corridor) {
1216
+ part.corridor[getStoreStateKey("highlight")] = true;
1217
+ refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
1218
+ }
1219
+ if (part.point) {
1220
+ part.point[getStoreStateKey("highlight")] = true;
1221
+ refreshColor(viewer, part.point, getAppliedOpacity(part.point));
1222
+ }
1223
+ if (part.ellipse) {
1224
+ part.ellipse[getStoreStateKey("highlight")] = true;
1225
+ refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
1226
+ }
1227
+ }
1228
+ }
1229
+ if (requestRender != false) {
1230
+ viewer.scene.requestRender();
1231
+ }
1232
+ }
1233
+ CesiumEntityStyler.Highlight = Highlight;
1234
+ /**
1235
+ * Removes the highlight from a graphic and refreshes it.
1236
+ * @param params
1237
+ */
1238
+ function Unhighlight(params) {
1239
+ var viewer = params.viewer, entity = params.entity, requestRender = params.requestRender;
1240
+ if (!entity) {
1241
+ return;
1242
+ }
1243
+ var parts = exports.EntityUtils.GatherEntity({
1244
+ entity: entity
1245
+ });
1246
+ for (var i = 0; i < parts.length; i++) {
1247
+ var part = parts[i];
1248
+ if (!isAlive(viewer, part)) {
1249
+ continue;
1250
+ }
1251
+ if (part instanceof Cesium.Cesium3DTileFeature) {
1252
+ part[getStoreStateKey("highlight")] = false;
1253
+ refreshColor(viewer, part, getAppliedOpacity(part));
1254
+ }
1255
+ else if (part instanceof Cesium.Entity) {
1256
+ if (part.billboard) {
1257
+ part.billboard[getStoreStateKey("highlight")] = false;
1258
+ refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
1259
+ }
1260
+ if (part.model) {
1261
+ part.model[getStoreStateKey("highlight")] = false;
1262
+ refreshColor(viewer, part.model, getAppliedOpacity(part.model));
1263
+ }
1264
+ if (part.polyline) {
1265
+ part.polyline[getStoreStateKey("highlight")] = false;
1266
+ refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
1267
+ }
1268
+ if (part.polygon) {
1269
+ part.polygon[getStoreStateKey("highlight")] = false;
1270
+ refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
1271
+ }
1272
+ if (part.corridor) {
1273
+ part.corridor[getStoreStateKey("highlight")] = false;
1274
+ refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
1275
+ }
1276
+ if (part.point) {
1277
+ part.point[getStoreStateKey("highlight")] = false;
1278
+ refreshColor(viewer, part.point, getAppliedOpacity(part.point));
1279
+ }
1280
+ if (part.ellipse) {
1281
+ part.ellipse[getStoreStateKey("highlight")] = false;
1282
+ refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
1283
+ }
1284
+ }
1285
+ }
1286
+ if (requestRender != false) {
1287
+ viewer.scene.requestRender();
1288
+ }
1289
+ }
1290
+ CesiumEntityStyler.Unhighlight = Unhighlight;
1291
+ })(CesiumEntityStyler || (CesiumEntityStyler = {}));
1292
+
1293
+ function traverseEntity(cEntity, arr, ignoreParent) {
1294
+ if (cEntity._parentEntity && !ignoreParent) {
1295
+ traverseEntity(cEntity._parentEntity, arr, false);
1296
+ }
1297
+ if (cEntity._siblingGraphics) {
1298
+ for (var i = 0; i < cEntity._siblingGraphics.length; i++) {
1299
+ var sibling = cEntity._siblingGraphics[i];
1300
+ traverseEntity(sibling, arr, true);
1301
+ }
1302
+ }
1303
+ arr.push(cEntity);
848
1304
  }
849
1305
  function GetValue(viewer, obj) {
850
1306
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
@@ -1806,10 +2262,12 @@
1806
2262
  */
1807
2263
  function SetOpacity(params) {
1808
2264
  var viewer = params.viewer, entity = params.entity, opacity = params.opacity, requestRender = params.requestRender;
1809
- applyOpacityToEntity(viewer, opacity, entity);
1810
- if (requestRender != false) {
1811
- viewer.scene.requestRender();
1812
- }
2265
+ CesiumEntityStyler.SetOpacity({
2266
+ entity: entity,
2267
+ opacity: opacity,
2268
+ viewer: viewer,
2269
+ requestRender: requestRender
2270
+ });
1813
2271
  }
1814
2272
  EntityUtils.SetOpacity = SetOpacity;
1815
2273
  /**
@@ -1820,10 +2278,11 @@
1820
2278
  */
1821
2279
  function RevertOpacity(params) {
1822
2280
  var viewer = params.viewer, entity = params.entity, requestRender = params.requestRender;
1823
- revertAppliedEntityOpacity(viewer, entity);
1824
- if (requestRender != false) {
1825
- viewer.scene.requestRender();
1826
- }
2281
+ CesiumEntityStyler.ClearOpacity({
2282
+ entity: entity,
2283
+ viewer: viewer,
2284
+ requestRender: requestRender
2285
+ });
1827
2286
  }
1828
2287
  EntityUtils.RevertOpacity = RevertOpacity;
1829
2288
  /**
@@ -1835,7 +2294,9 @@
1835
2294
  */
1836
2295
  function GetOpacity(params) {
1837
2296
  var entity = params.entity;
1838
- return findOpacity(entity);
2297
+ return CesiumEntityStyler.GetOpacity({
2298
+ entity: entity
2299
+ });
1839
2300
  }
1840
2301
  EntityUtils.GetOpacity = GetOpacity;
1841
2302
  })(exports.EntityUtils || (exports.EntityUtils = {}));
@@ -2463,8 +2924,13 @@
2463
2924
  var parts = exports.EntityUtils.GatherEntity({
2464
2925
  entity: rego.visual
2465
2926
  });
2927
+ var isolatedIds = register.GetIsolated();
2928
+ var hiddenIds = register.GetHidden();
2466
2929
  for (var i_1 = 0; i_1 < parts.length; i_1++) {
2467
2930
  var part = parts[i_1];
2931
+ if (!(part instanceof Cesium.Entity)) {
2932
+ continue;
2933
+ }
2468
2934
  var shouldCull = shouldCullEntity(viewer, part);
2469
2935
  if (shouldCull) {
2470
2936
  part[VisualRegisterCuller.VISUAL_CULL_KEY] = true;
@@ -2474,7 +2940,11 @@
2474
2940
  }
2475
2941
  else {
2476
2942
  delete part[VisualRegisterCuller.VISUAL_CULL_KEY];
2477
- if (!rego.overrideShow && rego.best && !viewer.entities.contains(part)) {
2943
+ if (rego.overrideShow != false &&
2944
+ rego.best &&
2945
+ !viewer.entities.contains(part) &&
2946
+ !hiddenIds.includes(entityId) &&
2947
+ (isolatedIds.length <= 0 || isolatedIds.includes(entityId))) {
2478
2948
  viewer.entities.add(part);
2479
2949
  }
2480
2950
  }
@@ -5634,137 +6104,6 @@
5634
6104
  }
5635
6105
  }
5636
6106
  }
5637
- var ORG_COLOR_KEY = "_org_color_";
5638
- function select(viewer, visual, color, reqRender) {
5639
- var _a;
5640
- if (!color) {
5641
- color = Cesium.Color.fromAlpha(Cesium.Color.YELLOW, 0.5);
5642
- }
5643
- if (visual instanceof Cesium.Entity) {
5644
- if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
5645
- return;
5646
- }
5647
- var entities = exports.EntityUtils.GatherEntity({
5648
- entity: visual
5649
- });
5650
- var keyMapping = {
5651
- "point": "color",
5652
- "polygon": "material",
5653
- "polyline": "material",
5654
- "model": "color",
5655
- "billboard": "color",
5656
- "corridor": "material",
5657
- "ellipse": "material"
5658
- };
5659
- var _loop_1 = function (i) {
5660
- var entity = entities[i];
5661
- var processGraphic = function (graphicKey, materialKey) {
5662
- if (entity[graphicKey]) {
5663
- if (entity[graphicKey][ORG_COLOR_KEY] == null) {
5664
- var orgColor = entity[graphicKey][materialKey];
5665
- if (!orgColor) {
5666
- orgColor = Cesium.Color.WHITE;
5667
- }
5668
- entity[graphicKey][ORG_COLOR_KEY] = orgColor.clone ? orgColor.clone() : orgColor;
5669
- }
5670
- entity[graphicKey][materialKey] = color.clone();
5671
- }
5672
- };
5673
- for (var key in keyMapping) {
5674
- var map = keyMapping[key];
5675
- processGraphic(key, map);
5676
- }
5677
- };
5678
- for (var i = 0; i < entities.length; i++) {
5679
- _loop_1(i);
5680
- }
5681
- }
5682
- if (visual instanceof Cesium.Primitive) ;
5683
- else if (visual instanceof Cesium.Cesium3DTileFeature) {
5684
- if (!isAlive$1(viewer, visual)) {
5685
- return;
5686
- }
5687
- var orgColor = visual[ORG_COLOR_KEY];
5688
- if (orgColor == null) {
5689
- orgColor = visual.color;
5690
- visual[ORG_COLOR_KEY] = (_a = orgColor === null || orgColor === void 0 ? void 0 : orgColor.clone) === null || _a === void 0 ? void 0 : _a.call(orgColor);
5691
- }
5692
- visual.color = color.clone();
5693
- }
5694
- var opacity = exports.EntityUtils.GetOpacity({
5695
- entity: visual
5696
- });
5697
- if (opacity != null) {
5698
- exports.EntityUtils.SetOpacity({
5699
- viewer: viewer,
5700
- entity: visual,
5701
- opacity: opacity,
5702
- requestRender: false
5703
- });
5704
- }
5705
- if (reqRender != false) {
5706
- viewer.scene.requestRender();
5707
- }
5708
- }
5709
- function deselect(viewer, visual, reqRender) {
5710
- if (visual instanceof Cesium.Entity) {
5711
- if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
5712
- return;
5713
- }
5714
- var entities = exports.EntityUtils.GatherEntity({
5715
- entity: visual
5716
- });
5717
- var keyMapping = {
5718
- "point": "color",
5719
- "polygon": "material",
5720
- "polyline": "material",
5721
- "model": "color",
5722
- "billboard": "color",
5723
- "corridor": "material",
5724
- "ellipse": "material"
5725
- };
5726
- var _loop_2 = function (i) {
5727
- var entity = entities[i];
5728
- var processGraphic = function (graphicKey, materialKey) {
5729
- var _a;
5730
- if ((_a = entity[graphicKey]) === null || _a === void 0 ? void 0 : _a[ORG_COLOR_KEY]) {
5731
- entity[graphicKey][materialKey] = entity[graphicKey][ORG_COLOR_KEY];
5732
- }
5733
- };
5734
- for (var key in keyMapping) {
5735
- var map = keyMapping[key];
5736
- processGraphic(key, map);
5737
- }
5738
- };
5739
- for (var i = 0; i < entities.length; i++) {
5740
- _loop_2(i);
5741
- }
5742
- }
5743
- if (visual instanceof Cesium.Primitive) ;
5744
- else if (visual instanceof Cesium.Cesium3DTileFeature) {
5745
- if (!isAlive$1(viewer, visual)) {
5746
- return;
5747
- }
5748
- var orgColor = visual[ORG_COLOR_KEY];
5749
- if (orgColor != null) {
5750
- visual.color = orgColor;
5751
- }
5752
- }
5753
- var opacity = exports.EntityUtils.GetOpacity({
5754
- entity: visual
5755
- });
5756
- if (opacity != null) {
5757
- exports.EntityUtils.SetOpacity({
5758
- viewer: viewer,
5759
- entity: visual,
5760
- opacity: opacity,
5761
- requestRender: false
5762
- });
5763
- }
5764
- if (reqRender != false) {
5765
- viewer.scene.requestRender();
5766
- }
5767
- }
5768
6107
  (function (VisualsRegister) {
5769
6108
  var EVisualUpdateType;
5770
6109
  (function (EVisualUpdateType) {
@@ -5781,6 +6120,7 @@
5781
6120
  this.selectedIds = [];
5782
6121
  this.isolatedIds = [];
5783
6122
  this.hiddenIds = [];
6123
+ this.highlightedIds = [];
5784
6124
  // Entity id -> opacity for visual.
5785
6125
  this.opacity = {};
5786
6126
  // Array of entity ids for entities who have labels drawn for them.
@@ -5851,7 +6191,7 @@
5851
6191
  */
5852
6192
  Register.prototype.SetLabelled = function (params) {
5853
6193
  var labelled = params.labelled, entityIds = params.entityIds, requestRender = params.requestRender;
5854
- var _loop_3 = function (i) {
6194
+ var _loop_1 = function (i) {
5855
6195
  var id = entityIds[i];
5856
6196
  var index = this_1.labelledEntityIds.findIndex(function (x) { return x == id; });
5857
6197
  if (labelled) {
@@ -5869,7 +6209,7 @@
5869
6209
  };
5870
6210
  var this_1 = this;
5871
6211
  for (var i = 0; i < entityIds.length; i++) {
5872
- _loop_3(i);
6212
+ _loop_1(i);
5873
6213
  }
5874
6214
  if (requestRender != false) {
5875
6215
  this.viewer.scene.requestRender();
@@ -5910,7 +6250,19 @@
5910
6250
  * @param color
5911
6251
  */
5912
6252
  Register.prototype.SetSelectionColor = function (color) {
5913
- this.selectionColor = color;
6253
+ if (color) {
6254
+ CesiumEntityStyler.UpdateColorSetting("select", color);
6255
+ }
6256
+ };
6257
+ /**
6258
+ * Updates the highlight color.
6259
+ * This will not update the highlight color for already highlighted entities.
6260
+ * @param color
6261
+ */
6262
+ Register.prototype.SetHighlightColor = function (color) {
6263
+ if (color) {
6264
+ CesiumEntityStyler.UpdateColorSetting("highlight", color);
6265
+ }
5914
6266
  };
5915
6267
  Register.prototype.SetSelected = function (params) {
5916
6268
  var _a;
@@ -5931,7 +6283,11 @@
5931
6283
  if (regos) {
5932
6284
  for (var i_1 = 0; i_1 < regos.length; i_1++) {
5933
6285
  var rego = regos[i_1];
5934
- select(this.viewer, rego.visual, this.selectionColor, false);
6286
+ CesiumEntityStyler.Select({
6287
+ entity: rego.visual,
6288
+ viewer: this.viewer,
6289
+ requestRender: false
6290
+ });
5935
6291
  }
5936
6292
  }
5937
6293
  }
@@ -5944,7 +6300,11 @@
5944
6300
  if (regos) {
5945
6301
  for (var i_2 = 0; i_2 < regos.length; i_2++) {
5946
6302
  var rego = regos[i_2];
5947
- deselect(this.viewer, rego.visual, false);
6303
+ CesiumEntityStyler.Deselect({
6304
+ entity: rego.visual,
6305
+ viewer: this.viewer,
6306
+ requestRender: false
6307
+ });
5948
6308
  }
5949
6309
  }
5950
6310
  }
@@ -5971,7 +6331,11 @@
5971
6331
  if (regos) {
5972
6332
  for (var i_3 = 0; i_3 < regos.length; i_3++) {
5973
6333
  var rego = regos[i_3];
5974
- deselect(this.viewer, rego.visual, false);
6334
+ CesiumEntityStyler.Deselect({
6335
+ entity: rego.visual,
6336
+ viewer: this.viewer,
6337
+ requestRender: false
6338
+ });
5975
6339
  }
5976
6340
  }
5977
6341
  }
@@ -5986,6 +6350,82 @@
5986
6350
  Register.prototype.GetSelected = function () {
5987
6351
  return this.selectedIds;
5988
6352
  };
6353
+ Register.prototype.SetHighlighted = function (params) {
6354
+ var entityIds = params.entityIds, highlighted = params.highlighted, refreshIfHighlighted = params.refreshIfHighlighted, requestRender = params.requestRender;
6355
+ if (refreshIfHighlighted == null) {
6356
+ refreshIfHighlighted = true;
6357
+ }
6358
+ for (var i = 0; i < entityIds.length; i++) {
6359
+ var id = entityIds[i];
6360
+ if (highlighted) {
6361
+ var doHighlight = refreshIfHighlighted;
6362
+ if (this.highlightedIds.indexOf(id) === -1) {
6363
+ this.highlightedIds.push(id);
6364
+ doHighlight = true;
6365
+ }
6366
+ if (doHighlight) {
6367
+ var regos = this.rego[id];
6368
+ if (regos) {
6369
+ for (var i_4 = 0; i_4 < regos.length; i_4++) {
6370
+ var rego = regos[i_4];
6371
+ CesiumEntityStyler.Highlight({
6372
+ entity: rego.visual,
6373
+ viewer: this.viewer,
6374
+ requestRender: false
6375
+ });
6376
+ }
6377
+ }
6378
+ }
6379
+ }
6380
+ else {
6381
+ var index = this.highlightedIds.indexOf(id);
6382
+ if (index !== -1) {
6383
+ this.highlightedIds.splice(index, 1);
6384
+ var regos = this.rego[id];
6385
+ if (regos) {
6386
+ for (var i_5 = 0; i_5 < regos.length; i_5++) {
6387
+ var rego = regos[i_5];
6388
+ CesiumEntityStyler.Unhighlight({
6389
+ entity: rego.visual,
6390
+ viewer: this.viewer,
6391
+ requestRender: false
6392
+ });
6393
+ }
6394
+ }
6395
+ }
6396
+ }
6397
+ }
6398
+ if (requestRender != false) {
6399
+ this.viewer.scene.requestRender();
6400
+ }
6401
+ };
6402
+ Register.prototype.GetIsHighlighted = function (params) {
6403
+ var id = params.entityId;
6404
+ return this.highlightedIds.indexOf(id) !== -1;
6405
+ };
6406
+ Register.prototype.ClearHighlighted = function (params) {
6407
+ for (var i = 0; i < this.highlightedIds.length; i++) {
6408
+ var id = this.highlightedIds[i];
6409
+ var regos = this.rego[id];
6410
+ if (regos) {
6411
+ for (var i_6 = 0; i_6 < regos.length; i_6++) {
6412
+ var rego = regos[i_6];
6413
+ CesiumEntityStyler.Unhighlight({
6414
+ entity: rego.visual,
6415
+ viewer: this.viewer,
6416
+ requestRender: false
6417
+ });
6418
+ }
6419
+ }
6420
+ }
6421
+ this.highlightedIds = [];
6422
+ if ((params === null || params === void 0 ? void 0 : params.requestRender) != false) {
6423
+ this.viewer.scene.requestRender();
6424
+ }
6425
+ };
6426
+ Register.prototype.GetHighlighted = function () {
6427
+ return this.highlightedIds;
6428
+ };
5989
6429
  Register.prototype.SetIsolated = function (params) {
5990
6430
  var _a;
5991
6431
  var entityIds = params.entityIds, isolate = params.isolated, requestRender = params.requestRender;
@@ -6096,7 +6536,12 @@
6096
6536
  updateEntity(this.viewer, entityId, this);
6097
6537
  var selected = this.selectedIds.includes(entityId);
6098
6538
  if (selected) {
6099
- select(this.viewer, rego.visual, this.selectionColor, false);
6539
+ // select(this.viewer, rego.visual, this.selectionColor, false);
6540
+ CesiumEntityStyler.Select({
6541
+ entity: rego.visual,
6542
+ viewer: this.viewer,
6543
+ requestRender: false
6544
+ });
6100
6545
  }
6101
6546
  var opacity = this.opacity[entityId];
6102
6547
  if (opacity != null && opacity != 1) {
@@ -6237,7 +6682,7 @@
6237
6682
  return;
6238
6683
  }
6239
6684
  var menuItems = menuItemId ? [menuItemId] : entityRegos.map(function (x) { return x.menuItemId; });
6240
- var _loop_4 = function (i) {
6685
+ var _loop_2 = function (i) {
6241
6686
  var menuItemId_2 = menuItems[i];
6242
6687
  var rego = entityRegos.find(function (r) { return r.menuItemId === menuItemId_2; });
6243
6688
  if (!rego) {
@@ -6259,7 +6704,7 @@
6259
6704
  };
6260
6705
  var this_2 = this;
6261
6706
  for (var i = 0; i < menuItems.length; i++) {
6262
- var state_1 = _loop_4(i);
6707
+ var state_1 = _loop_2(i);
6263
6708
  if (typeof state_1 === "object")
6264
6709
  return state_1.value;
6265
6710
  }
@@ -6307,7 +6752,7 @@
6307
6752
  var height = Math.ceil(EnsureNumber(params.height, 5));
6308
6753
  var pickLimit = Math.ceil(EnsureNumber(params.pickLimit, 5));
6309
6754
  var picked = this.viewer.scene.drillPick(new Cesium.Cartesian2(cursor.x, cursor.y), pickLimit, width, height);
6310
- var _loop_5 = function (i) {
6755
+ var _loop_3 = function (i) {
6311
6756
  var object = picked[i];
6312
6757
  var entity = (object && object.id && object.id instanceof Cesium.Entity ? object.id : object);
6313
6758
  var visual = entity;
@@ -6320,7 +6765,7 @@
6320
6765
  };
6321
6766
  var this_3 = this;
6322
6767
  for (var i = 0; i < picked.length; i++) {
6323
- _loop_5(i);
6768
+ _loop_3(i);
6324
6769
  }
6325
6770
  return {
6326
6771
  regos: found
@@ -6381,6 +6826,7 @@
6381
6826
  var entityIds = params.entityIds, menuItemIds = params.menuItemId, requestRender = params.requestRender;
6382
6827
  for (var _i = 0, entityIds_2 = entityIds; _i < entityIds_2.length; _i++) {
6383
6828
  var entityId = entityIds_2[_i];
6829
+ this.opacity[entityId] = params.opacity;
6384
6830
  var regos = this.rego[entityId];
6385
6831
  if (regos && regos.length) {
6386
6832
  for (var _b = 0, regos_2 = regos; _b < regos_2.length; _b++) {
@@ -6402,7 +6848,6 @@
6402
6848
  requestRender: false
6403
6849
  });
6404
6850
  }
6405
- this.opacity[rego.entityId] = params.opacity;
6406
6851
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({
6407
6852
  rego: rego,
6408
6853
  type: EVisualUpdateType.Update,
@@ -14815,11 +15260,15 @@
14815
15260
  this._disposeCesiumEvent();
14816
15261
  var events = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
14817
15262
  var lastHoverPos = null;
15263
+ var lastHoveredEntityId = null;
15264
+ var unhighlightTimeout = null;
14818
15265
  var process2dCursor = function (pos2d, isHover) {
14819
15266
  try {
14820
15267
  var regos = _this._manager.VisualsRegister.GetRegosFromCursor({
14821
15268
  cursor: pos2d
14822
15269
  }).regos;
15270
+ var first = regos.length ? regos[0] : null;
15271
+ var firstId_1 = first === null || first === void 0 ? void 0 : first.entityId;
14823
15272
  if (isHover) {
14824
15273
  if (regos.length) {
14825
15274
  _this._viewer.canvas.style.cursor = "pointer";
@@ -14827,13 +15276,37 @@
14827
15276
  else if (_this._viewer.canvas.style.cursor) {
14828
15277
  _this._viewer.canvas.style.removeProperty("cursor");
14829
15278
  }
15279
+ clearTimeout(unhighlightTimeout);
15280
+ if (lastHoveredEntityId && lastHoveredEntityId != firstId_1) {
15281
+ _this._manager.VisualsRegister.SetHighlighted({
15282
+ entityIds: [lastHoveredEntityId],
15283
+ highlighted: false
15284
+ });
15285
+ }
15286
+ if (firstId_1) {
15287
+ unhighlightTimeout = setTimeout(function () {
15288
+ if (lastHoveredEntityId == firstId_1) {
15289
+ _this._manager.VisualsRegister.SetHighlighted({
15290
+ entityIds: [firstId_1],
15291
+ highlighted: false
15292
+ });
15293
+ lastHoveredEntityId = null;
15294
+ }
15295
+ }, 5000);
15296
+ if (lastHoveredEntityId != firstId_1) {
15297
+ _this._manager.VisualsRegister.SetHighlighted({
15298
+ entityIds: [firstId_1],
15299
+ highlighted: true
15300
+ });
15301
+ }
15302
+ }
15303
+ lastHoveredEntityId = firstId_1;
14830
15304
  }
14831
15305
  else {
14832
- var first = regos.length ? regos[0] : null;
14833
15306
  _this._manager.VisualsRegister.ClearSelected();
14834
15307
  if (first) {
14835
15308
  _this._manager.VisualsRegister.SetSelected({
14836
- entityIds: [first.entityId],
15309
+ entityIds: [firstId_1],
14837
15310
  selected: true
14838
15311
  });
14839
15312
  }
@@ -15482,6 +15955,7 @@
15482
15955
  var isFirstEnabled = !this._lastEnabledBookmarkId;
15483
15956
  this._lastEnabledBookmarkId = bookmark.ID;
15484
15957
  this._updateBookmark();
15958
+ // console.log("render bookmark", bookmark.ID);
15485
15959
  exports.ViewRenderEngine.Render({
15486
15960
  apiGetter: this._apiGetters.GetBruceGetter(),
15487
15961
  bookmark: bookmark,
@@ -15508,6 +15982,20 @@
15508
15982
  var record = index > -1 ? this.bookmarks[index] : null;
15509
15983
  this._name.innerText = record ? record.Title ? record.Title : "Unnamed bookmark" : "Unknown bookmark";
15510
15984
  this._chip.innerText = "".concat(index > -1 ? (index + 1) + "/" : "").concat(this.bookmarks.length);
15985
+ // Scroll the selected bookmark into view.
15986
+ var selected = this._row.querySelector(".NextspaceBookmarksRowItem[is-selected='true']");
15987
+ if (selected) {
15988
+ var scrollLeft = this._row.scrollLeft;
15989
+ var scrollRight = scrollLeft + this._row.clientWidth;
15990
+ var left = selected.offsetLeft;
15991
+ var right = left + selected.clientWidth;
15992
+ if (left < scrollLeft) {
15993
+ this._row.scrollLeft = left;
15994
+ }
15995
+ else if (right > scrollRight) {
15996
+ this._row.scrollLeft = right - this._row.clientWidth;
15997
+ }
15998
+ }
15511
15999
  };
15512
16000
  return WidgetBookmarks;
15513
16001
  }(Widget.AWidget));
@@ -19352,7 +19840,7 @@
19352
19840
  CesiumViewMonitor.Monitor = Monitor;
19353
19841
  })(exports.CesiumViewMonitor || (exports.CesiumViewMonitor = {}));
19354
19842
 
19355
- var VERSION$1 = "3.2.4";
19843
+ var VERSION$1 = "3.2.6";
19356
19844
 
19357
19845
  exports.VERSION = VERSION$1;
19358
19846
  exports.CesiumParabola = CesiumParabola;