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

uber / deck.gl / 13074

28 Aug 2019 - 0:36 coverage decreased (-2.5%) to 80.994%
13074

Pull #3496

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
use timeline
Pull Request #3496: Transition system refactor (1/2): use timeline

3394 of 4574 branches covered (74.2%)

Branch coverage included in aggregate %.

54 of 58 new or added lines in 9 files covered. (93.1%)

818 existing lines in 101 files now uncovered.

6953 of 8201 relevant lines covered (84.78%)

4628.87 hits per line

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

60.0
/modules/extensions/src/brushing/brushing.js
1
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
6×
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to deal
5
// in the Software without restriction, including without limitation the rights
6
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
// copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
// THE SOFTWARE.
20

21
import {LayerExtension} from '@deck.gl/core';
22
import shaderModule from './shader-module';
23

24
const defaultProps = {
1×
25
  getBrushingTarget: {type: 'accessor', value: [0, 0]},
26

27
  brushingTarget: 'source',
28
  brushingEnabled: true,
29
  brushingRadius: 10000
30
};
31

32
export default class BrushingExtension extends LayerExtension {
33
  getShaders(extension) {
34
    return {
1×
35
      modules: [shaderModule]
36
    };
37
  }
38

39
  initializeState(context, extension) {
40
    const attributeManager = this.getAttributeManager();
1×
41
    if (attributeManager) {
Branches [[0, 1]] missed. 1×
42
      attributeManager.add({
1×
43
        brushingTargets: {
44
          size: 2,
45
          accessor: 'getBrushingTarget',
46
          // Hack: extension's defaultProps is not merged with the layer's defaultProps,
47
          // So we can't use the standard accessor when the prop is undefined
48
          update: !this.props.getBrushingTarget && extension.useConstantTargetPositions,
Branches [[1, 1]] missed.
49
          shaderAttributes: {
50
            brushingTargets: {
51
              divisor: 0
52
            },
53
            instanceBrushingTargets: {
54
              divisor: 1
55
            }
56
          }
57
        }
58
      });
59
    }
60

61
    // Trigger redraw when mouse moves
62
    // TODO - expose this in a better way
63
    extension.onMouseMove = () => {
1×
UNCOV
64
      this.getCurrentLayer().setNeedsRedraw();
!
65
    };
66
    if (this.context.deck) {
Branches [[2, 0]] missed. 1×
UNCOV
67
      this.context.deck.eventManager.on({
!
68
        pointermove: extension.onMouseMove,
69
        pointerleave: extension.onMouseMove
70
      });
71
    }
72
  }
73

74
  finalizeState(extension) {
75
    // Remove event listeners
76
    if (this.context.deck) {
Branches [[3, 0]] missed. 1×
UNCOV
77
      this.context.deck.eventManager.off({
!
78
        pointermove: extension.onMouseMove,
79
        pointerleave: extension.onMouseMove
80
      });
81
    }
82
  }
83

84
  useConstantTargetPositions(attribute) {
UNCOV
85
    attribute.constant = true;
!
UNCOV
86
    attribute.value = new Float32Array(2);
!
87
    return;
!
88
  }
89
}
90

91
BrushingExtension.extensionName = 'BrushingExtension';
1×
92
BrushingExtension.defaultProps = defaultProps;
1×
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