cesium-xs-sdk 1.0.14 → 1.0.15

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.
@@ -3198,15 +3198,32 @@ class GraphicModule {
3198
3198
  const positions = this._getEntityPositions(entity);
3199
3199
  if (positions.length < 3) return false;
3200
3200
 
3201
- const closedPositions = [...positions, positions[0]];
3202
3201
  const outlineId = `${graphicId}_outline`;
3203
3202
  const color = options.color ?? Cesium$f.Color.WHITE;
3204
3203
  const width = options.width ?? 2;
3205
3204
 
3205
+ // 用 CallbackProperty 实时跟随主 polygon 的 hierarchy,
3206
+ // 这样 SDK 内部 EditTool 拖拽顶点时,外边框会自动跟随移动。
3207
+ const mainEntity = entity;
3208
+ const positionsCallback = new Cesium$f.CallbackProperty(() => {
3209
+ const hierarchy = mainEntity.polygon?.hierarchy;
3210
+ if (!hierarchy) return [];
3211
+ let positions;
3212
+ if (typeof hierarchy.getValue === 'function') {
3213
+ const value = hierarchy.getValue(Cesium$f.JulianDate.now());
3214
+ positions = value?.positions || [];
3215
+ } else {
3216
+ positions = hierarchy.positions || [];
3217
+ }
3218
+ if (!positions || positions.length < 3) return positions || [];
3219
+ // 闭合:首点再加到末尾
3220
+ return [...positions, positions[0]];
3221
+ }, false);
3222
+
3206
3223
  this.viewer.entities.add({
3207
3224
  id: outlineId,
3208
3225
  polyline: {
3209
- positions: closedPositions,
3226
+ positions: positionsCallback,
3210
3227
  width,
3211
3228
  material: color,
3212
3229
  clampToGround: true,