UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

436 lines (413 loc) 56.2 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.fitBoundsUpdater = exports.INITIAL_MAP_STATE = void 0; exports.getMapDimForSplitMap = getMapDimForSplitMap; exports.pickViewportPropsFromMapState = pickViewportPropsFromMapState; exports.updateMapUpdater = exports.toggleSplitMapViewportUpdater = exports.toggleSplitMapUpdater = exports.togglePerspectiveUpdater = exports.resetMapConfigUpdater = exports.receiveMapConfigUpdater = void 0; var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _geoViewport = _interopRequireDefault(require("@mapbox/geo-viewport")); var _booleanWithin = _interopRequireDefault(require("@turf/boolean-within")); var _bboxPolygon = _interopRequireDefault(require("@turf/bbox-polygon")); var _webMercator = require("@math.gl/web-mercator"); var _deepmerge = _interopRequireDefault(require("deepmerge")); var _lodash = _interopRequireDefault(require("lodash.pick")); var _utils = require("@kepler.gl/utils"); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project /** * Updaters for `mapState` reducer. Can be used in your root reducer to directly modify kepler.gl's state. * Read more about [Using updaters](../advanced-usage/using-updaters.md) * @public * @example * * import keplerGlReducer, {mapStateUpdaters} from 'kepler.gl/reducers'; * // Root Reducer * const reducers = combineReducers({ * keplerGl: keplerGlReducer, * app: appReducer * }); * * const composedReducer = (state, action) => { * switch (action.type) { * // click button to close side panel * case 'CLICK_BUTTON': * return { * ...state, * keplerGl: { * ...state.keplerGl, * foo: { * ...state.keplerGl.foo, * mapState: mapStateUpdaters.fitBoundsUpdater( * mapState, {payload: [127.34, 31.09, 127.56, 31.59]]} * ) * } * } * }; * } * return reducers(state, action); * }; * * export default composedReducer; */ /* eslint-disable @typescript-eslint/no-unused-vars */ // @ts-ignore var mapStateUpdaters = null; /* eslint-enable @typescript-eslint/no-unused-vars */ /** * Default initial `mapState` * @memberof mapStateUpdaters * @constant * @property pitch Default: `0` * @property bearing Default: `0` * @property latitude Default: `37.75043` * @property longitude Default: `-122.34679` * @property zoom Default: `9` * @property dragRotate Default: `false` * @property width Default: `800` * @property height Default: `800` * @property minZoom: `undefined`, * @property maxZoom: `undefined`, * @property maxBounds: `undefined`, * @property isSplit: `false`, * @property isViewportSynced: `true`, * @property isZoomLocked: `false`, * @property splitMapViewports: `[]` * @public */ var INITIAL_MAP_STATE = exports.INITIAL_MAP_STATE = { pitch: 0, bearing: 0, latitude: 37.75043, longitude: -122.34679, zoom: 9, dragRotate: false, width: 800, height: 800, minZoom: undefined, maxZoom: undefined, maxBounds: undefined, isSplit: false, isViewportSynced: true, isZoomLocked: false, splitMapViewports: [] }; /* Updaters */ /** * Update map viewport * @memberof mapStateUpdaters * @public */ var updateMapUpdater = exports.updateMapUpdater = function updateMapUpdater(state, action) { var _action$payload = action.payload, inputViewport = _action$payload.viewport, _action$payload$mapIn = _action$payload.mapIndex, mapIndex = _action$payload$mapIn === void 0 ? 0 : _action$payload$mapIn; var viewport = (0, _utils.validateViewPort)(inputViewport); if (state.isViewportSynced) { // The `updateViewport` function is typed as (Viewport, Viewport) -> Viewport but here the // expected typing is (MapState, Viewport) -> MapState. // this could be a potential bug as we treat Viewport and MapState as equal seemingly // @ts-expect-error Type 'Viewport' is missing the following properties from type 'MapState': isSplit, isViewportSynced, isZoomLocked, splitMapViewports return updateViewport(state, viewport); } var otherViewportMapIndex = -1; var splitMapViewports = state.splitMapViewports.map(function (currentViewport, i) { if (i === mapIndex) { // update the matching viewport with the newViewport info in the action payload return updateViewport(currentViewport, viewport); } otherViewportMapIndex = i; // make no changes to the other viewport (yet) return currentViewport; }); // make conditional updates to the other viewport not matching this payload's `mapIndex` if (Number.isFinite(otherViewportMapIndex) && otherViewportMapIndex > -1) { // width and height are a special case and are always updated splitMapViewports[otherViewportMapIndex] = _objectSpread(_objectSpread({}, splitMapViewports[otherViewportMapIndex]), {}, { width: splitMapViewports[mapIndex].width, height: splitMapViewports[mapIndex].height }); if (state.isZoomLocked) { // update the other viewport with the new zoom from the split viewport that was updated with this payload's `mapIndex` splitMapViewports[otherViewportMapIndex] = _objectSpread(_objectSpread({}, splitMapViewports[otherViewportMapIndex]), {}, { zoom: splitMapViewports[mapIndex].zoom }); } } return _objectSpread(_objectSpread(_objectSpread({}, state), splitMapViewports[mapIndex]), {}, { // update the mapState with the new array of split viewports splitMapViewports: splitMapViewports }); }; /** * Fit map viewport to bounds * @memberof mapStateUpdaters * @public */ var fitBoundsUpdater = exports.fitBoundsUpdater = function fitBoundsUpdater(state, action) { var centerAndZoom = (0, _utils.getCenterAndZoomFromBounds)(action.payload, { width: state.width, height: state.height }); if (!centerAndZoom) { // bounds is invalid return state; } var newState = _objectSpread(_objectSpread({}, state), {}, { latitude: centerAndZoom.center[1], longitude: centerAndZoom.center[0] }, Number.isFinite(centerAndZoom.zoom) ? { zoom: centerAndZoom.zoom } : {}); // if fitting to bounds while split and unsynced // copy the new latitude, longitude, and zoom values to each split viewport if (newState.splitMapViewports.length) { newState.splitMapViewports = newState.splitMapViewports.map(function (currentViewport) { return _objectSpread(_objectSpread({}, currentViewport), {}, { latitude: newState.latitude, longitude: newState.longitude, zoom: newState.zoom }); }); } return newState; }; /** * Toggle between 3d and 2d map. * @memberof mapStateUpdaters * @public */ var togglePerspectiveUpdater = exports.togglePerspectiveUpdater = function togglePerspectiveUpdater(state) { var newState = _objectSpread(_objectSpread(_objectSpread({}, state), { pitch: state.dragRotate ? 0 : 50, bearing: state.dragRotate ? 0 : 24 }), {}, { dragRotate: !state.dragRotate }); // if toggling 3d and 2d while split and unsynced // copy the new pitch, bearing, and dragRotate values to each split viewport if (newState.splitMapViewports.length) { newState.splitMapViewports = newState.splitMapViewports.map(function (currentViewport) { return _objectSpread(_objectSpread({}, currentViewport), {}, { pitch: newState.pitch, bearing: newState.bearing, dragRotate: newState.dragRotate }); }); } return newState; }; /** * reset mapState to initial State * @memberof mapStateUpdaters * @public */ var resetMapConfigUpdater = exports.resetMapConfigUpdater = function resetMapConfigUpdater(state) { return _objectSpread(_objectSpread(_objectSpread({}, INITIAL_MAP_STATE), state.initialState), {}, { initialState: state.initialState }); }; // consider case where you have a split map and user wants to reset /** * Update `mapState` to propagate a new config * @memberof mapStateUpdaters * @public */ var receiveMapConfigUpdater = exports.receiveMapConfigUpdater = function receiveMapConfigUpdater(state, _ref) { var _ref$payload = _ref.payload, _ref$payload$config = _ref$payload.config, config = _ref$payload$config === void 0 ? {} : _ref$payload$config, _ref$payload$options = _ref$payload.options, options = _ref$payload$options === void 0 ? {} : _ref$payload$options, _ref$payload$bounds = _ref$payload.bounds, bounds = _ref$payload$bounds === void 0 ? null : _ref$payload$bounds; /** * @type {Partial<MapState>} */ var mapState = (config || {}).mapState || {}; // merged received mapState with previous state // state also may include properties that are new to an existing, saved project's mapState var mergedState = (0, _deepmerge["default"])(state, mapState, { // note: deepmerge by default will merge arrays by concatenating them // but we need to overwrite destination arrays with source arrays, if present // https://github.com/TehShrike/deepmerge#arraymerge-example-overwrite-target-array arrayMerge: function arrayMerge(_destinationArray, sourceArray) { return sourceArray; } }); // if center map // center map will override mapState config if (options.centerMap && bounds) { mergedState = fitBoundsUpdater(mergedState, { payload: bounds }); } // make sure we validate map state before we merge mergedState = (0, _utils.validateViewPort)(mergedState); return _objectSpread(_objectSpread({}, mergedState), getMapDimForSplitMap(mergedState.isSplit, state)); }; /** * Toggle between one or split maps * @memberof mapStateUpdaters * @public */ var toggleSplitMapUpdater = exports.toggleSplitMapUpdater = function toggleSplitMapUpdater(state) { return _objectSpread(_objectSpread(_objectSpread({}, state), getMapDimForSplitMap(!state.isSplit, state)), {}, { isSplit: !state.isSplit }, !state.isSplit === false ? { // if toggling to no longer split (single mode) then reset a few properties isViewportSynced: true, isZoomLocked: false, splitMapViewports: [] } : {}); }; /** * Toggle between locked and unlocked split viewports * @memberof mapStateUpdaters * @public */ var toggleSplitMapViewportUpdater = exports.toggleSplitMapViewportUpdater = function toggleSplitMapViewportUpdater(state, action) { // new map state immediately gets the new, optional payload values for isViewportSynced and/or isZoomLocked var newMapState = _objectSpread(_objectSpread({}, state), action.payload || {}); if (newMapState.isViewportSynced) { // switching from unsynced to synced viewports newMapState.splitMapViewports = []; } else { // switching from synced to unsynced viewports // or already in unsynced mode and toggling locked zoom if (state.isZoomLocked && !newMapState.isZoomLocked) { // switching off locked zoom while unsynced // don't copy the mapStates to left and right viewports because there will be zoom "jumping" return newMapState; } if (!state.isZoomLocked && newMapState.isZoomLocked) { // switching on locked zoom while unsynced // only copy zoom viewport property from the most recently interacted-with viewport to the other // TODO: do we want to check for a match a different way, such as a combo of `latitude` and `longitude`? var lastUpdatedViewportIndex = newMapState.splitMapViewports.findIndex(function (v) { return newMapState.zoom === v.zoom; }); var splitMapViewports = newMapState.splitMapViewports.map(function (currentViewport, i) { if (i === lastUpdatedViewportIndex) { // no zoom to modify here return currentViewport; } // the other viewport gets the most recently interacted-with viewport's zoom // WHY? the viewport the user was last interacting with will set zoom across the board for smooth UX return _objectSpread(_objectSpread({}, currentViewport), {}, { zoom: newMapState.splitMapViewports[lastUpdatedViewportIndex].zoom }); }); newMapState.splitMapViewports = splitMapViewports; return newMapState; } // if current viewport is synced, and we are unsyncing it // or already in unsynced mode and NOT toggling locked zoom // make a fresh copy of the current viewport object, assign it to splitMapViewports[] // pickViewportPropsFromMapState is called twice to avoid memory allocation conflicts var leftViewport = pickViewportPropsFromMapState(newMapState); var rightViewport = pickViewportPropsFromMapState(newMapState); newMapState.splitMapViewports = [leftViewport, rightViewport]; } // return new state return newMapState; }; // Helpers function getMapDimForSplitMap(isSplit, state) { // cases: // 1. state split: true - isSplit: true // do nothing // 2. state split: false - isSplit: false // do nothing if (state.isSplit === isSplit) { return {}; } var width = state.isSplit && !isSplit ? // 3. state split: true - isSplit: false // double width state.width * 2 : // 4. state split: false - isSplit: true // split width state.width / 2; return { width: width }; } function updateViewportBasedOnBounds(state, newMapState) { // Get the new viewport bounds var viewportBounds = _geoViewport["default"].bounds([newMapState.longitude, newMapState.latitude], newMapState.zoom, [newMapState.width, newMapState.height], _utils.MAPBOX_TILE_SIZE); // Generate turf Polygon from bounds for comparison var viewportBoundsPolygon = (0, _bboxPolygon["default"])(viewportBounds); // @ts-ignore var newStateMaxBounds = newMapState.maxBounds; // @ts-ignore var maxBoundsPolygon = (0, _bboxPolygon["default"])(newStateMaxBounds); // If maxBounds has changed reset the viewport to snap to bounds var hasMaxBoundsChanged = !state.maxBounds || !state.maxBounds.every(function (val, idx) { return val === newStateMaxBounds[idx]; }); if (hasMaxBoundsChanged) { // Check if the newMapState viewport is within maxBounds if (!(0, _booleanWithin["default"])(viewportBoundsPolygon, maxBoundsPolygon)) { var _fitBounds = (0, _webMercator.fitBounds)({ width: newMapState.width, height: newMapState.width, bounds: [[newStateMaxBounds[0], newStateMaxBounds[1]], [newStateMaxBounds[2], newStateMaxBounds[3]]] }), latitude = _fitBounds.latitude, longitude = _fitBounds.longitude, zoom = _fitBounds.zoom; newMapState = _objectSpread(_objectSpread({}, newMapState), {}, { latitude: latitude, longitude: longitude }, Number.isFinite(zoom) ? { zoom: zoom } : {}); } return newMapState; } // Check if the newMapState viewport is within maxBounds if (!(0, _booleanWithin["default"])(viewportBoundsPolygon, maxBoundsPolygon)) { newMapState = _objectSpread(_objectSpread({}, newMapState), {}, { longitude: state.longitude, latitude: state.latitude, zoom: state.zoom }); } return newMapState; } function pickViewportPropsFromMapState(state) { return (0, _lodash["default"])(state, ['width', 'height', 'zoom', 'pitch', 'bearing', 'latitude', 'longitude', 'dragRotate', 'minZoom', 'maxZoom', 'maxBounds']); } /** Select items from object whose value is not undefined */ var definedProps = function definedProps(obj) { return Object.entries(obj).reduce(function (accu, _ref2) { var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2), k = _ref3[0], v = _ref3[1]; return _objectSpread(_objectSpread({}, accu), v !== undefined ? (0, _defineProperty2["default"])({}, k, v) : {}); }, {}); }; function updateViewport(originalViewport, viewportUpdates) { var newViewport = _objectSpread(_objectSpread({}, originalViewport), definedProps(viewportUpdates) || {}); // Make sure zoom level doesn't go bellow minZoom if defined if (newViewport.minZoom && newViewport.zoom && newViewport.zoom < newViewport.minZoom) { newViewport.zoom = newViewport.minZoom; } // Make sure zoom level doesn't go above maxZoom if defined if (newViewport.maxZoom && newViewport.zoom && newViewport.zoom > newViewport.maxZoom) { newViewport.zoom = newViewport.maxZoom; } // Limit viewport update based on maxBounds if (newViewport.maxBounds && (0, _utils.validateBounds)(newViewport.maxBounds)) { // @ts-expect-error Type 'Viewport' is missing the following properties from type 'MapState': isSplit, isViewportSynced, isZoomLocked, splitMapViewports newViewport = updateViewportBasedOnBounds(originalViewport, newViewport); } return newViewport; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfZ2VvVmlld3BvcnQiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwicmVxdWlyZSIsIl9ib29sZWFuV2l0aGluIiwiX2Jib3hQb2x5Z29uIiwiX3dlYk1lcmNhdG9yIiwiX2RlZXBtZXJnZSIsIl9sb2Rhc2giLCJfdXRpbHMiLCJvd25LZXlzIiwiZSIsInIiLCJ0IiwiT2JqZWN0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