How to use the react-map-gl/utils/transition.LinearInterpolator 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 / linear-interpolator.spec.js View on Github external
test('LinearInterpolator#constructor', t => {
  let interpolator = new LinearInterpolator();
  t.ok(interpolator, 'constructor does not throw error');
  t.deepEqual(
    interpolator.propNames,
    ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'],
    'propNames is set'
  );

  interpolator = new LinearInterpolator(['width', 'height']);
  t.deepEqual(interpolator.propNames, ['width', 'height'], 'propNames is set');

  interpolator = new LinearInterpolator({around: [0, 0]});
  t.deepEqual(
    interpolator.propNames,
    ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'],
    'propNames is set'
  );
github uber / react-map-gl / test / src / utils / transition / linear-interpolator.spec.js View on Github external
test('LinearInterpolator#constructor', t => {
  let interpolator = new LinearInterpolator();
  t.ok(interpolator, 'constructor does not throw error');
  t.deepEqual(
    interpolator.propNames,
    ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'],
    'propNames is set'
  );

  interpolator = new LinearInterpolator(['width', 'height']);
  t.deepEqual(interpolator.propNames, ['width', 'height'], 'propNames is set');

  interpolator = new LinearInterpolator({around: [0, 0]});
  t.deepEqual(
    interpolator.propNames,
    ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'],
    'propNames is set'
  );
  t.deepEqual(interpolator.around, [0, 0], 'center is set');

  interpolator = new LinearInterpolator({
    transitionProps: ['pitch'],
    around: [0, 0]
  });
  t.deepEqual(interpolator.propNames, ['pitch'], 'propNames is set');
  t.deepEqual(interpolator.around, [0, 0], 'center is set');
github uber / react-map-gl / test / src / utils / transition / linear-interpolator.spec.js View on Github external
test('LinearInterpolator#constructor', t => {
  let interpolator = new LinearInterpolator();
  t.ok(interpolator, 'constructor does not throw error');
  t.deepEqual(
    interpolator.propNames,
    ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'],
    'propNames is set'
  );

  interpolator = new LinearInterpolator(['width', 'height']);
  t.deepEqual(interpolator.propNames, ['width', 'height'], 'propNames is set');

  interpolator = new LinearInterpolator({around: [0, 0]});
  t.deepEqual(
    interpolator.propNames,
    ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'],
    'propNames is set'
  );
  t.deepEqual(interpolator.around, [0, 0], 'center is set');

  interpolator = new LinearInterpolator({
    transitionProps: ['pitch'],
    around: [0, 0]
  });
  t.deepEqual(interpolator.propNames, ['pitch'], 'propNames is set');
  t.deepEqual(interpolator.around, [0, 0], 'center is set');

  t.end();
});
github uber / react-map-gl / test / src / utils / transition / linear-interpolator.spec.js View on Github external
TEST_CASES.forEach(testCase => {
    const interpolator = new LinearInterpolator(testCase.transitionProps);
    const getResult = () => interpolator.initializeProps(testCase.startProps, testCase.endProps);

    if (testCase.shouldThrow) {
      t.throws(getResult, testCase.title);
    } else {
      t.deepEqual(getResult(), testCase.expect, testCase.title);
    }
  });
github uber / react-map-gl / test / src / utils / transition / linear-interpolator.spec.js View on Github external
TEST_CASES.filter(testCase => testCase.transition).forEach(testCase => {
    const interpolator = new LinearInterpolator(testCase.transitionProps);
    Object.keys(testCase.transition).forEach(time => {
      const propsInTransition = interpolator.interpolateProps(
        testCase.expect.start,
        testCase.expect.end,
        Number(time)
      );
      t.deepEqual(propsInTransition, testCase.transition[time], time);
    });
  });