How to use the @here/harp-mapview.MapViewUtils.orbitFocusPoint function in @here/harp-mapview

To help you get started, we’ve selected a few @here/harp-mapview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp-map-controls / lib / MapControls.ts View on Github external
const deltaRotation =
                this.m_touchState.currentRotation - this.m_touchState.initialRotation;
            this.stopExistingAnimations();
            MapViewUtils.rotate(this.mapView, THREE.Math.radToDeg(deltaRotation));
            this.moveAlongTheViewDirection(pinchDistance);
        }

        // Tilting
        if (this.m_touchState.touches.length === 3 && this.tiltEnabled) {
            const firstTouch = this.m_touchState.touches[0];
            const diff = this.m_tmpVector2.subVectors(
                firstTouch.currentTouchPoint,
                firstTouch.lastTouchPoint
            );
            this.stopExistingAnimations();
            MapViewUtils.orbitFocusPoint(
                this.mapView,
                this.orbitingTouchDeltaFactor * diff.x,
                -this.orbitingTouchDeltaFactor * diff.y,
                this.m_maxTiltAngle
            );
        }

        this.m_zoomAnimationStartTime = performance.now();

        this.updateMapView();
        event.preventDefault();
        event.stopPropagation();
    }
github heremaps / harp.gl / @here / harp-map-controls / lib / MapControls.ts View on Github external
// center of the screen, in order to limit the tilt to `maxTiltAngle`, as we change
        // this tilt by changing the camera's height above.
        if (
            this.mapView.projection.type === geoUtils.ProjectionType.Spherical &&
            this.m_maxTiltAngle !== undefined
        ) {
            const centerScreenTarget = MapViewUtils.rayCastWorldCoordinates(this.mapView, 0, 0);
            if (centerScreenTarget !== null) {
                const tilt = MapViewUtils.extractSphericalCoordinatesFromLocation(
                    this.mapView,
                    this.camera,
                    this.mapView.projection.unprojectPoint(centerScreenTarget)
                ).tilt;
                const deltaTilt = tilt - this.m_maxTiltAngle;
                if (deltaTilt > 0) {
                    MapViewUtils.orbitFocusPoint(this.mapView, 0, deltaTilt, this.m_maxTiltAngle);
                }
            }
        }

        this.updateMapView();
        this.mapView.addEventListener(
            MapViewEventNames.AfterRender,
            this.assignZoomAfterTouchZoomRender
        );
    }
github heremaps / harp.gl / @here / harp-map-controls / lib / MapControls.ts View on Github external
}

        this.m_currentTilt = this.inertiaEnabled
            ? this.easeOutCubic(
                  this.m_startTilt,
                  this.targetedTilt,
                  Math.min(1, this.m_tiltAnimationTime / this.tiltToggleDuration)
              )
            : this.targetedTilt;

        const initialTilt = this.currentTilt;
        const deltaAngle = this.m_currentTilt - initialTilt;
        const oldCameraDistance = this.mapView.camera.position.z / Math.cos(initialTilt);
        const newHeight = Math.cos(this.currentTilt) * oldCameraDistance;

        MapViewUtils.orbitFocusPoint(
            this.mapView,
            newHeight - this.camera.position.z,
            THREE.Math.radToDeg(deltaAngle),
            this.m_maxTiltAngle
        );
        this.updateMapView();
    }
github heremaps / harp.gl / @here / harp-map-controls / lib / MapControls.ts View on Github external
} else {
                this.m_needsRenderLastFrame = true;
            }
        }
        this.m_lastAzimuth = this.m_currentAzimuth;
        this.m_currentAzimuth = this.inertiaEnabled
            ? this.easeOutCubic(
                  this.m_startAzimuth,
                  0,
                  Math.min(1, animationTime / this.m_resetNorthAnimationDuration)
              )
            : 0;

        const deltaAzimuth = this.m_currentAzimuth - this.m_lastAzimuth;

        MapViewUtils.orbitFocusPoint(
            this.mapView,
            THREE.Math.radToDeg(deltaAzimuth),
            0,
            this.m_maxTiltAngle
        );
        this.updateMapView();
    }
github heremaps / harp.gl / @here / harp-map-controls / lib / MapControls.ts View on Github external
if (vectors === undefined) {
                return;
            }
            const { fromWorld, toWorld } = vectors;
            this.panFromTo(fromWorld, toWorld);
        } else if (this.m_state === State.ROTATE) {
            this.stopExistingAnimations();
            MapViewUtils.rotate(
                this.mapView,
                -this.rotationMouseDeltaFactor * this.m_mouseDelta.x,
                this.rotationMouseDeltaFactor * this.m_mouseDelta.y,
                this.m_maxTiltAngle
            );
        } else if (this.m_state === State.ORBIT) {
            this.stopExistingAnimations();
            MapViewUtils.orbitFocusPoint(
                this.mapView,
                this.orbitingMouseDeltaFactor * this.m_mouseDelta.x,
                -this.orbitingMouseDeltaFactor * this.m_mouseDelta.y,
                this.m_maxTiltAngle
            );
        }

        this.m_lastMousePosition.set(event.clientX, event.clientY);
        this.m_zoomAnimationStartTime = performance.now();

        this.updateMapView();
        event.preventDefault();
        event.stopPropagation();
    }