How to use the viewport-mercator-project.normalizeViewportProps function in viewport-mercator-project

To help you get started, we’ve selected a few viewport-mercator-project 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 uber / react-map-gl / src / utils / map-state.js View on Github external
_applyConstraints(props: ViewportProps): ViewportProps {
    // Ensure zoom is within specified range
    const {maxZoom, minZoom, zoom} = props;
    props.zoom = clamp(zoom, minZoom, maxZoom);

    // Ensure pitch is within specified range
    const {maxPitch, minPitch, pitch} = props;
    props.pitch = clamp(pitch, minPitch, maxPitch);

    Object.assign(props, normalizeViewportProps(props));

    return props;
  }
github uber / deck.gl / modules / core / src / core / controllers / map-state.js View on Github external
_applyConstraints(props) {
    // Ensure zoom is within specified range
    const {maxZoom, minZoom, zoom} = props;
    props.zoom = clamp(zoom, minZoom, maxZoom);

    // Ensure pitch is within specified range
    const {maxPitch, minPitch, pitch} = props;
    props.pitch = clamp(pitch, minPitch, maxPitch);

    Object.assign(props, normalizeViewportProps(props));

    return props;
  }
github uber-archive / viewport-mercator-project / test / spec / normalize-viewport-props.spec.js View on Github external
test('normalizeViewportProps', (t) => {
  config.EPSILON = 1e-7;

  for (const [input, expected] of NORMALIZATION_TEST_CASES) {
    const result = normalizeViewportProps(input);

    t.ok(equals(
        Object.keys(expected).map(key => result[key]),
        Object.keys(expected).map(key => expected[key])
      ),
      'correct viewport returned'
    );
  }
  t.end();
});