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

uber / deck.gl / 13758

17 Sep 2019 - 21:06 coverage increased (+2.9%) to 82.762%
13758

Pull #3621

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
fix CI
Pull Request #3621: Support spring transition in UniformTransitionManager

3406 of 4621 branches covered (73.71%)

Branch coverage included in aggregate %.

59 of 63 new or added lines in 6 files covered. (93.65%)

499 existing lines in 85 files now uncovered.

7200 of 8194 relevant lines covered (87.87%)

4274.03 hits per line

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

92.0
/modules/react/src/utils/position-children-under-views.js
1
import {createElement} from 'react';
2
import {View, log} from '@deck.gl/core';
3
import {inheritsFrom} from './inherits-from';
4
import evaluateChildren from './evaluate-children';
5

6
// Iterate over views and reposition children associated with views
7
// TODO - Can we supply a similar function for the non-React case?
8
export default function positionChildrenUnderViews({children, viewports, deck, ContextProvider}) {
9
  const {viewManager} = deck || {};
1×
10

11
  if (!viewManager || !viewManager.views.length) {
9×
12
    return [];
1×
13
  }
14

15
  const defaultViewId = viewManager.views[0].id;
1×
16

17
  return children.map((child, i) => {
1×
18
    if (child.props.viewportId) {
Branches [[3, 0]] missed. 1×
19
      log.removed('viewportId', '<View>')();
1×
20
    }
21
    if (child.props.viewId) {
Branches [[4, 0]] missed. 1×
22
      log.removed('viewId', '<View>')();
1×
23
    }
24

25
    // Unless child is a View, position / render as part of the default view
26
    let viewId = defaultViewId;
1×
27
    let viewChildren = child;
2×
28

29
    if (inheritsFrom(child.type, View)) {
8×
30
      viewId = child.props.id || defaultViewId;
8×
31
      viewChildren = child.props.children;
5×
32
    }
33
    const childStyle = viewChildren && viewChildren.props && viewChildren.props.style;
3×
34

35
    const viewport = viewManager.getViewport(viewId);
3×
36
    const viewState = viewManager.getViewState(viewId);
9×
37

38
    // Drop (auto-hide) elements with viewId that are not matched by any current view
UNCOV
39
    if (!viewport) {
!
40
      return null;
9×
41
    }
42

43
    // Resolve potentially relative dimensions using the deck.gl container size
UNCOV
44
    const {x, y, width, height} = viewport;
!
45

46
    viewChildren = evaluateChildren(viewChildren, {
9×
47
      x,
48
      y,
49
      width,
50
      height,
51
      viewport,
52
      viewState
53
    });
54

55
    const style = {
9×
56
      position: 'absolute',
57
      // Use child's z-index for ordering
58
      zIndex: childStyle && childStyle.zIndex,
59
      // If this container is on top, it will block interaction with the deck canvas
60
      pointerEvents: 'none',
61
      left: x,
62
      top: y,
63
      width,
64
      height
65
    };
66
    const key = `view-child-${viewId}-${i}`;
9×
67

68
    if (ContextProvider) {
6×
69
      const contextValue = {
6×
70
        viewport,
71
        container: deck.canvas.offsetParent,
72
        eventManager: deck.eventManager,
73
        onViewStateChange: deck._onViewStateChange
74
      };
75
      viewChildren = createElement(ContextProvider, {value: contextValue}, viewChildren);
9×
76
    }
77

78
    return createElement('div', {key, id: key, style}, viewChildren);
9×
79
  });
80
}
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