zincjs 1.8.2 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zincjs",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "ZincJS (Web-based-Zinc-Visualisation)",
5
5
  "main": "build/zinc.js",
6
6
  "directories": {
package/src/controls.js CHANGED
@@ -227,7 +227,8 @@ const CameraControls = function ( object, domElement, renderer, scene ) {
227
227
 
228
228
  this.getVisibleHeightAtZDepth = ( depth ) => {
229
229
  // compensate for cameras not positioned at z=0
230
- const cameraOffset = this.cameraObject.position.z;
230
+
231
+ const cameraOffset = this.cameraObject.position.distanceTo(this.cameraObject.target);
231
232
  if ( depth < cameraOffset ) depth -= cameraOffset;
232
233
  else depth += cameraOffset;
233
234
 
@@ -1535,7 +1536,8 @@ const RayCaster = function (sceneIn, hostSceneIn, callbackFunctionIn, hoverCallb
1535
1536
  const length = pickedObjects.length;
1536
1537
  for (let i = 0; i < length; i++) {
1537
1538
  let zincObject = pickedObjects[i].object ? pickedObjects[i].object.userData : undefined;
1538
- if (zincObject && zincObject.isMarkerCluster && zincObject.visible) {
1539
+ if (zincObject && zincObject.isMarkerCluster && zincObject.visible
1540
+ && zincObject.clusterIsVisible(pickedObjects[i].object.clusterIndex)) {
1539
1541
  zincObject.zoomToCluster(pickedObjects[i].object.clusterIndex);
1540
1542
  return;
1541
1543
  }
@@ -218,6 +218,15 @@ const MarkerCluster = function(sceneIn) {
218
218
  this.markerUpdateRequired = true;
219
219
  }
220
220
  }
221
+
222
+ this.clusterIsVisible = (index) => {
223
+ if (index !== undefined && index > -1) {
224
+ if (sprites[index]) {
225
+ return sprites[index].group?.visible;
226
+ }
227
+ }
228
+ return false;
229
+ }
221
230
  }
222
231
 
223
232
  MarkerCluster.prototype = Object.create((require('./zincObject').ZincObject).prototype);