# @here/harp-map-controls

> Camera controller which implements a common default set of camera functionality in a map context.

Latest version **0.28.0** (published 2022-01-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @here/harp-map-controls
pnpm add @here/harp-map-controls
yarn add @here/harp-map-controls
bun add @here/harp-map-controls
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.28.0 |
| Published | 2022-01-17 |
| First published | 2019-03-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 150.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1317 |
| Author | HERE Europe B.V. |
| Maintainers | here-bot, here-maps, heremaps |

## Links

- npm: https://www.npmjs.com/package/@here/harp-map-controls
- Repository: https://github.com/heremaps/harp.gl
- Homepage: https://github.com/heremaps/harp.gl#readme
- Issues: https://github.com/heremaps/harp.gl/issues
- npm.io page: https://npm.io/package/@here/harp-map-controls

## Dependencies (4)

- [@here/harp-utils](https://npm.io/package/@here/harp-utils.md) ^0.28.0
- [@tweenjs/tween.js](https://npm.io/package/@tweenjs/tween.js.md) ^18.6.4
- [@here/harp-mapview](https://npm.io/package/@here/harp-mapview.md) ^0.28.0
- [@here/harp-geoutils](https://npm.io/package/@here/harp-geoutils.md) ^0.28.0

## Recent versions

- 0.28.0 (latest) — 2022-01-17
- 0.11.0-alpha.0 (alpha) — 2019-10-16
- 0.27.1 — 2021-09-30
- 0.27.0 — 2021-09-27
- 0.26.0 — 2021-08-03
- 0.25.0 — 2021-05-25
- 0.24.0 — 2021-04-08
- 0.23.1 — 2021-03-16
- 0.22.1 — 2021-03-16
- 0.23.0 — 2021-03-09
- 0.22.0 — 2021-01-28
- 0.21.1 — 2020-11-03
- 0.21.0 — 2020-11-02
- 0.20.1 — 2020-09-23
- 0.20.0 — 2020-09-22
- … 23 more at https://npm.io/package/@here/harp-map-controls/versions

## README

# @here/harp-map-controls

## Overview

This module provides MapControls and MapAnimations which implement a common default set of camera functionality in a map context.

### Using the MapAnimations

The MapAnimations can simply be added to the existing MapView. The animations should not start from
the beginning, but after a few seconds, so the MapView has time to load the data for the first tiles.
A timeOut of 2000ms should be fine for most situations.

### CameraRotationAnimation

For the CameraRotationAnimation, the
MapControls that may be employed to manipulate the view should also be passed in, so the camera
animation can pause during the manipulation.

```typescript
const camRot = new CameraRotationAnimation(this.mapView, this.mapControls,
    {
        axis: new THREE.Vector3(0, 0, 1),
        duration: (20. * 1000),
        endAngle: 720
    });

this.mapView.addEventListener("render", (event: RenderEvent) => {
    camRot.update();
})

camRot.start();
```

### CameraPanAnimation

The CameraPanAnimation is not connected to the MapControls. If moves along the specified path, while
the camera orientation is not changed, it may be animated independently.

```typescript
this.mapView.geoCenter = new GeoCoordinates(52.515276, 13.377689000000002, 8000);

const camPan = new CameraPanAnimation(this.mapView,
    {
        // low level flight above Berlin
        // duration: (40. * 1000),
        // geoCoordinates: [
        //     new GeoCoordinates(52.52006626, 13.40764352, 800),
        //     new GeoCoordinates(52.48094817, 13.3909456, 800),
        //     new GeoCoordinates(52.518611, 13.376111, 800)
        // ],

        // Longer lasting higher level flight above Germany and France.
        duration: (400. * 1000),
        geoCoordinates: [
            new GeoCoordinates(48.138137, 11.575682, 15000),
            new GeoCoordinates(50.93873, 6.95236, 10000),
            new GeoCoordinates(48.853190, 2.348585, 8000)
        ],

        repeat: Infinity,
        interpolation: InterpolationFunction.CatmullRom
    });

this.mapView.addEventListener("render", (event: RenderEvent) => {
    camPan.update();
})

camPan.start();
```

---
_Source: https://npm.io/package/@here/harp-map-controls · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
