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/build/zinc.frontend.js +1 -1
- package/build/zinc.js +5 -5
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/controls.js +20 -16
- package/src/primitives/markerCluster.js +9 -0
package/package.json
CHANGED
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
|
-
|
|
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
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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);
|