zincjs 1.8.1 → 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.1",
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
 
@@ -349,20 +350,22 @@ const CameraControls = function ( object, domElement, renderer, scene ) {
349
350
 
350
351
  const onDocumentMouseMove = event => {
351
352
  updateRect(false);
352
- this.pointer_x = event.clientX - rect.left;
353
- this.pointer_y = event.clientY - rect.top;
354
- if (currentMode === MODE.MINIMAP) {
355
- let minimapCoordinates = this.scene.getNormalisedMinimapCoordinates(this.renderer, event);
356
- if (minimapCoordinates) {
357
- let translation = this.scene.getMinimapDiffFromNormalised(
358
- minimapCoordinates.x, minimapCoordinates.y);
359
- translateViewport(translation);
360
- }
361
- } else {
362
- if ((this._state === STATE.NONE) && (zincRayCaster !== undefined)) {
363
- zincRayCaster.move(this, event.clientX, event.clientY, this.renderer);
364
- }
365
- }
353
+ if (rect) {
354
+ this.pointer_x = event.clientX - rect.left;
355
+ this.pointer_y = event.clientY - rect.top;
356
+ if (currentMode === MODE.MINIMAP) {
357
+ let minimapCoordinates = this.scene.getNormalisedMinimapCoordinates(this.renderer, event);
358
+ if (minimapCoordinates) {
359
+ let translation = this.scene.getMinimapDiffFromNormalised(
360
+ minimapCoordinates.x, minimapCoordinates.y);
361
+ translateViewport(translation);
362
+ }
363
+ } else {
364
+ if ((this._state === STATE.NONE) && (zincRayCaster !== undefined)) {
365
+ zincRayCaster.move(this, event.clientX, event.clientY, this.renderer);
366
+ }
367
+ }
368
+ }
366
369
  }
367
370
 
368
371
  const onDocumentMouseUp = event => {
@@ -1533,7 +1536,8 @@ const RayCaster = function (sceneIn, hostSceneIn, callbackFunctionIn, hoverCallb
1533
1536
  const length = pickedObjects.length;
1534
1537
  for (let i = 0; i < length; i++) {
1535
1538
  let zincObject = pickedObjects[i].object ? pickedObjects[i].object.userData : undefined;
1536
- if (zincObject && zincObject.isMarkerCluster && zincObject.visible) {
1539
+ if (zincObject && zincObject.isMarkerCluster && zincObject.visible
1540
+ && zincObject.clusterIsVisible(pickedObjects[i].object.clusterIndex)) {
1537
1541
  zincObject.zoomToCluster(pickedObjects[i].object.clusterIndex);
1538
1542
  return;
1539
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);