kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
55 lines (53 loc) • 10.1 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _icons = require("../common/icons");
var _styledComponents = require("../common/styled-components");
var _mapControlTooltip = _interopRequireDefault(require("./map-control-tooltip"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
Toggle3dButtonFactory.deps = [_mapControlTooltip["default"]];
function Toggle3dButtonFactory(MapControlTooltip) {
var defaultActionIcons = {
cube: _icons.Cube3d
};
/** @type {import('./toggle-3d-button').Toggle3dButtonComponent} */
var Toggle3dButton = function Toggle3dButton(_ref) {
var dragRotate = _ref.dragRotate,
onTogglePerspective = _ref.onTogglePerspective,
_ref$actionIcons = _ref.actionIcons,
actionIcons = _ref$actionIcons === void 0 ? defaultActionIcons : _ref$actionIcons,
mapControls = _ref.mapControls;
var onClick = (0, _react.useCallback)(function (event) {
event.preventDefault();
onTogglePerspective();
}, [onTogglePerspective]);
var isVisible = (0, _react.useMemo)(function () {
return ((mapControls === null || mapControls === void 0 ? void 0 : mapControls.toggle3d) || {}).show;
}, [mapControls]);
return isVisible ? /*#__PURE__*/_react["default"].createElement(MapControlTooltip, {
id: "action-3d",
message: dragRotate ? 'tooltip.disable3DMap' : 'tooltip.3DMap'
}, /*#__PURE__*/_react["default"].createElement(_styledComponents.MapControlButton, {
onClick: onClick,
active: dragRotate,
className: (0, _classnames["default"])('map-control-button', 'toggle-3d', {
map3d: dragRotate
})
}, /*#__PURE__*/_react["default"].createElement(actionIcons.cube, {
height: "22px"
}))) : null;
};
Toggle3dButton.displayName = 'Toggle3dButton';
return /*#__PURE__*/_react["default"].memo(Toggle3dButton);
}
var _default = exports["default"] = Toggle3dButtonFactory;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfY2xhc3NuYW1lcyIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJfaWNvbnMiLCJfc3R5bGVkQ29tcG9uZW50cyIsIl9tYXBDb250cm9sVG9vbHRpcCIsIl9nZXRSZXF1aXJlV2lsZGNhcmRDYWNoZSIsImUiLCJXZWFrTWFwIiwiciIsInQiLCJfX2VzTW9kdWxlIiwiX3R5cGVvZiIsImhhcyIsImdldCIsIm4iLCJfX3Byb3RvX18iLCJhIiwiT2JqZWN0IiwiZGVmaW5lUHJvcGVydHkiLCJnZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IiLCJ1IiwiaGFzT3duUHJvcGVydHkiLCJjYWxsIiwiaSIsInNldCIsIlRvZ2dsZTNkQnV0dG9uRmFjdG9yeSIsImRlcHMiLCJNYXBDb250cm9sVG9vbHRpcEZhY3RvcnkiLCJNYXBDb250cm9sVG9vbHRpcCIsImRlZmF1bHRBY3Rpb25JY29ucyIsImN1YmUiLCJDdWJlM2QiLCJUb2dnbGUzZEJ1dHRvbiIsIl9yZWYiL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