kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
105 lines (101 loc) • 12.4 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.updateMap = exports.toggleSplitMapViewport = exports.toggleSplitMap = exports.togglePerspective = exports.fitBounds = void 0;
var _toolkit = require("@reduxjs/toolkit");
var _actionTypes = _interopRequireDefault(require("./action-types"));
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
/**
*
* Toggle between 3d and 2d map.
* @memberof mapStateActions
* @public
* @example
* import {togglePerspective} from 'kepler.gl/actions';
* this.props.dispatch(togglePerspective());
*/
var togglePerspective = exports.togglePerspective = (0, _toolkit.createAction)(_actionTypes["default"].TOGGLE_PERSPECTIVE);
/**
* Fit map viewport to bounds
* @memberof mapStateActions
* @param {Array<Number>} bounds as `[lngMin, latMin, lngMax, latMax]`
* @public
* @example
* import {fitBounds} from 'kepler.gl/actions';
* this.props.dispatch(fitBounds([-122.23, 37.127, -122.11, 37.456]));
*/
var fitBounds = exports.fitBounds = (0, _toolkit.createAction)(_actionTypes["default"].FIT_BOUNDS, function (bounds) {
return {
payload: bounds
};
});
/**
* Update map viewport
* @memberof mapStateActions
* @param {Object} viewport viewport object container one or any of these properties `width`, `height`, `latitude` `longitude`, `zoom`, `pitch`, `bearing`, `dragRotate`
* @param {Number} [viewport.width] Width of viewport
* @param {Number} [viewport.height] Height of viewport
* @param {Number} [viewport.zoom] Zoom of viewport
* @param {Number} [viewport.pitch] Camera angle in degrees (0 is straight down)
* @param {Number} [viewport.bearing] Map rotation in degrees (0 means north is up)
* @param {Number} [viewport.latitude] Latitude center of viewport on map in mercator projection
* @param {Number} [viewport.longitude] Longitude Center of viewport on map in mercator projection
* @param {boolean} [viewport.dragRotate] Whether to enable drag and rotate map into perspective viewport
* @param {number} mapIndex Index of which map to update the viewport of
* @public
* @example
* import {updateMap} from 'kepler.gl/actions';
* this.props.dispatch(updateMap({latitude: 37.75043, longitude: -122.34679, width: 800, height: 1200}, 0));
*/
var updateMap = exports.updateMap = (0, _toolkit.createAction)(_actionTypes["default"].UPDATE_MAP, function (viewport, mapIndex) {
return {
payload: {
viewport: viewport,
mapIndex: mapIndex
}
};
});
/**
* Toggle between single map or split maps
* @memberof mapStateActions
* @param {Number} [index] index is provided, close split map at index
* @public
* @example
* import {toggleSplitMap} from 'kepler.gl/actions';
* this.props.dispatch(toggleSplitMap());
*/
var toggleSplitMap = exports.toggleSplitMap = (0, _toolkit.createAction)(_actionTypes["default"].TOGGLE_SPLIT_MAP, function (index) {
return {
payload: index
};
});
/**
* For split maps, toggle between having (un)synced viewports and (un)locked zooms
* @memberof mapStateActions
* @param {Object} syncInfo
* @param {boolean} [syncInfo.isViewportSynced] Are the 2 split maps having synced viewports?
* @param {boolean} [syncInfo.isZoomLocked] If split, are the zooms locked to each other or independent?
*/
var toggleSplitMapViewport = exports.toggleSplitMapViewport = (0, _toolkit.createAction)(_actionTypes["default"].TOGGLE_SPLIT_MAP_VIEWPORT, function (syncInfo) {
return {
payload: syncInfo
};
});
/**
* This declaration is needed to group actions in docs
*/
/**
* Actions handled mostly by `mapState` reducer.
* They manage map viewport update, toggle between 2d and 3d map,
* toggle between single and split maps.
*
* @public
*/
/* eslint-disable @typescript-eslint/no-unused-vars */
// @ts-ignore
var mapStateActions = null;
/* eslint-enable @typescript-eslint/no-unused-vars */
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfdG9vbGtpdCIsInJlcXVpcmUiLCJfYWN0aW9uVHlwZXMiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwidG9nZ2xlUGVyc3BlY3RpdmUiLCJleHBvcnRzIiwiY3JlYXRlQWN0aW9uIiwiQWN0aW9uVHlwZXMiLCJUT0dHTEVfUEVSU1BFQ1RJVkUiLCJmaXRCb3VuZHMiLCJGSVRfQk9VTkRTIiwiYm91bmRzIiwicGF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