How to use the react-map-gl/utils/transition.ViewportFlyToInterpolator function in react-map-gl

To help you get started, we’ve selected a few react-map-gl 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 / test / src / utils / transition / viewport-fly-to-interpolator.spec.js View on Github external
test('ViewportFlyToInterpolator#interpolateProps', t => {
  const interpolator = new ViewportFlyToInterpolator();

  TEST_CASES.filter(testCase => testCase.transition).forEach(testCase => {
    Object.keys(testCase.transition).forEach(time => {
      const propsInTransition = interpolator.interpolateProps(
        testCase.expect.start,
        testCase.expect.end,
        Number(time)
      );
      t.deepEqual(toLowPrecision(propsInTransition, 7), testCase.transition[time], time);
    });
  });

  t.end();
});
github uber / react-map-gl / test / src / utils / transition / viewport-fly-to-interpolator.spec.js View on Github external
test('ViewportFlyToInterpolator#initializeProps', t => {
  const interpolator = new ViewportFlyToInterpolator();

  TEST_CASES.forEach(testCase => {
    const getResult = () => interpolator.initializeProps(testCase.startProps, testCase.endProps);

    if (testCase.shouldThrow) {
      t.throws(getResult, testCase.title);
    } else {
      t.deepEqual(getResult(), testCase.expect, testCase.title);
    }
  });

  t.end();
});
github uber / react-map-gl / test / src / utils / transition / viewport-fly-to-interpolator.spec.js View on Github external
DURATION_TEST_CASES.forEach(testCase => {
    const interpolator = new ViewportFlyToInterpolator(testCase.opts);
    t.equal(
      toLowPrecision(
        interpolator.getDuration(START_PROPS, Object.assign({}, END_PROPS, testCase.endProps)),
        7
      ),
      testCase.expected,
      `${testCase.title}: should receive correct duration`
    );
  });
  t.end();