cesiumjs-anywidget 0.3.0__tar.gz → 0.4.0__tar.gz

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.
@@ -211,4 +211,4 @@ node_modules/
211
211
  package-lock.json
212
212
 
213
213
  # Generated/bundled files - source is in js/ subdirectory
214
- src/cesiumjs_anywidget/index.js
214
+ src/cesiumjs_anywidget/index.js
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cesiumjs-anywidget
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: A Jupyter widget for CesiumJS 3D globe visualization using anywidget
5
5
  Project-URL: Homepage, https://github.com/Alex-PLACET/cesiumjs_anywidget
6
6
  Project-URL: Repository, https://github.com/Alex-PLACET/cesiumjs_anywidget
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "cesiumjs-anywidget"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "A Jupyter widget for CesiumJS 3D globe visualization using anywidget"
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -935,23 +935,42 @@ function initializeMeasurementTools(viewer, model, container) {
935
935
  </button>
936
936
  `;
937
937
  editorPanel.style.display = "block";
938
- document.getElementById("apply-coords").onclick = () => {
939
- const lon = parseFloat(document.getElementById("edit-lon").value);
940
- const lat = parseFloat(document.getElementById("edit-lat").value);
941
- const alt = parseFloat(document.getElementById("edit-alt").value);
942
- const newPosition = Cesium.Cartesian3.fromDegrees(lon, lat, alt);
943
- updatePointPosition(newPosition);
944
- finalizeMeasurementUpdate();
945
- };
946
- document.getElementById("close-editor").onclick = () => {
947
- deselectPoint();
948
- };
949
- ["edit-lon", "edit-lat", "edit-alt"].forEach((id) => {
950
- document.getElementById(id).onkeypress = (e) => {
951
- if (e.key === "Enter") {
952
- document.getElementById("apply-coords").click();
938
+ const applyBtn = document.getElementById("apply-coords");
939
+ const closeBtn = document.getElementById("close-editor");
940
+ const editLonInput = document.getElementById("edit-lon");
941
+ const editLatInput = document.getElementById("edit-lat");
942
+ const editAltInput = document.getElementById("edit-alt");
943
+ if (!applyBtn || !closeBtn || !editLonInput || !editLatInput || !editAltInput) {
944
+ console.warn("[CesiumWidget] Editor panel input elements not found in DOM");
945
+ }
946
+ if (applyBtn) {
947
+ applyBtn.onclick = () => {
948
+ if (!editLonInput || !editLatInput || !editAltInput) {
949
+ console.warn("[CesiumWidget] Editor input fields not available");
950
+ return;
953
951
  }
952
+ const lon = parseFloat(editLonInput.value);
953
+ const lat = parseFloat(editLatInput.value);
954
+ const alt = parseFloat(editAltInput.value);
955
+ const newPosition = Cesium.Cartesian3.fromDegrees(lon, lat, alt);
956
+ updatePointPosition(newPosition);
957
+ finalizeMeasurementUpdate();
954
958
  };
959
+ }
960
+ if (closeBtn) {
961
+ closeBtn.onclick = () => {
962
+ deselectPoint();
963
+ };
964
+ }
965
+ ["edit-lon", "edit-lat", "edit-alt"].forEach((id) => {
966
+ const element = document.getElementById(id);
967
+ if (element) {
968
+ element.onkeypress = (e) => {
969
+ if (e.key === "Enter" && applyBtn) {
970
+ applyBtn.click();
971
+ }
972
+ };
973
+ }
955
974
  });
956
975
  }
957
976
  function updatePointPosition(newPosition) {
@@ -1105,6 +1124,10 @@ function initializeMeasurementTools(viewer, model, container) {
1105
1124
  function updateMeasurementsList() {
1106
1125
  const results = model.get("measurement_results") || [];
1107
1126
  const listContent = document.getElementById("measurements-list-content");
1127
+ if (!listContent) {
1128
+ console.warn("[CesiumWidget] Measurements list content element not found in DOM");
1129
+ return;
1130
+ }
1108
1131
  if (results.length === 0) {
1109
1132
  listContent.innerHTML = '<div style="color: #888; font-style: italic;">No measurements yet</div>';
1110
1133
  return;
@@ -1155,10 +1178,15 @@ function initializeMeasurementTools(viewer, model, container) {
1155
1178
  }
1156
1179
  };
1157
1180
  listContent.appendChild(measurementDiv);
1158
- document.getElementById(`rename-${index}`).onclick = (e) => {
1159
- e.stopPropagation();
1160
- renameMeasurement(index, name);
1161
- };
1181
+ const renameBtn = document.getElementById(`rename-${index}`);
1182
+ if (renameBtn) {
1183
+ renameBtn.onclick = (e) => {
1184
+ e.stopPropagation();
1185
+ renameMeasurement(index, name);
1186
+ };
1187
+ } else {
1188
+ console.warn(`[CesiumWidget] Rename button not found for measurement ${index}`);
1189
+ }
1162
1190
  });
1163
1191
  }
1164
1192
  function getMeasurementColor(type) {
@@ -364,7 +364,7 @@ wheels = [
364
364
 
365
365
  [[package]]
366
366
  name = "cesiumjs-anywidget"
367
- version = "0.3.0"
367
+ version = "0.4.0"
368
368
  source = { editable = "." }
369
369
  dependencies = [
370
370
  { name = "anywidget" },