Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

uber / deck.gl / 13030

26 Aug 2019 - 19:27 coverage decreased (-2.6%) to 80.38%
13030

Pull #3490

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
integrate mapbox's near plane fix
Pull Request #3490: [MapboxLayer] integrate mapbox-gl's near plane fix

3369 of 4577 branches covered (73.61%)

Branch coverage included in aggregate %.

6877 of 8170 relevant lines covered (84.17%)

4644.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/modules/core/src/controllers/view-state.js
1
import {Vector3, _SphericalCoordinates as SphericalCoordinates} from 'math.gl';
8×
2
import assert from '../utils/assert';
3

4
const defaultState = {
1×
5
  position: [0, 0, 0],
6
  lookAt: [0, 0, 0],
7
  up: [0, 0, 1],
8

9
  rotationX: 0,
10
  rotationY: 0,
11

12
  fov: 50,
13
  near: 1,
14
  far: 100
15
};
16

17
/* Helpers */
18

19
export default class ViewState {
20
  constructor(opts) {
21
    const {
22
      width, // Width of viewport
23
      height, // Height of viewport
24

25
      // Position and orientation
26
      position = defaultState.position // typically in meters from anchor point
27
    } = opts;
465×
28

29
    assert(Number.isFinite(width), '`width` must be supplied');
465×
30
    assert(Number.isFinite(height), '`height` must be supplied');
465×
31

32
    this._viewportProps = this._applyConstraints(
465×
33
      Object.assign({}, opts, {
34
        position: new Vector3(position)
35
      })
36
    );
37
  }
38

39
  getViewportProps() {
40
    return this._viewportProps;
41×
41
  }
42

43
  getDirection() {
44
    const spherical = new SphericalCoordinates({
3×
45
      bearing: this._viewportProps.bearing,
46
      pitch: this._viewportProps.pitch
47
    });
48
    const direction = spherical.toVector3().normalize();
3×
49
    return direction;
3×
50
  }
51

52
  getDirectionFromBearing(bearing) {
UNCOV
53
    const spherical = new SphericalCoordinates({
!
54
      bearing,
55
      pitch: 90
56
    });
UNCOV
57
    const direction = spherical.toVector3().normalize();
!
UNCOV
58
    return direction;
!
59
  }
60

61
  shortestPathFrom(viewState) {
UNCOV
62
    return this._viewportProps;
!
63
  }
64

65
  // Redefined by subclass
66
  // Apply any constraints (mathematical or defined by _viewportProps) to map state
67
  _applyConstraints(props) {
68
    return props;
70×
69
  }
70
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2019 Coveralls, LLC