kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
95 lines (72 loc) • 9.68 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _classnames = _interopRequireDefault(require("classnames"));
var _styledComponents2 = require("../styled-components");
var _icons = require("../icons");
function _templateObject2() {
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 6px 4px;\n svg {\n margin: 0 6px;\n }\n"]);
_templateObject2 = function _templateObject2() {
return data;
};
return data;
}
function _templateObject() {
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-right: 12px;\n\n &.disabled {\n opacity: 0.4;\n pointer-events: none;\n }\n"]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
var StyledAnimationControls = _styledComponents["default"].div(_templateObject());
var IconButton = (0, _styledComponents["default"])(_styledComponents2.Button)(_templateObject2());
function nop() {}
var DEFAULT_BUTTON_HEIGHT = '18px';
function AnimationPlaybacksFactory() {
var AnimationPlaybacks = function AnimationPlaybacks(_ref) {
var isAnimatable = _ref.isAnimatable,
isAnimating = _ref.isAnimating,
buttonStyle = _ref.buttonStyle,
_ref$pauseAnimation = _ref.pauseAnimation,
pauseAnimation = _ref$pauseAnimation === void 0 ? nop : _ref$pauseAnimation,
_ref$updateAnimationT = _ref.updateAnimationTime,
updateAnimationTime = _ref$updateAnimationT === void 0 ? nop : _ref$updateAnimationT,
_ref$startAnimation = _ref.startAnimation,
startAnimation = _ref$startAnimation === void 0 ? nop : _ref$startAnimation,
_ref$buttonHeight = _ref.buttonHeight,
buttonHeight = _ref$buttonHeight === void 0 ? DEFAULT_BUTTON_HEIGHT : _ref$buttonHeight;
var btnStyle = buttonStyle ? (0, _defineProperty2["default"])({}, buttonStyle, true) : {};
return _react["default"].createElement(StyledAnimationControls, {
className: (0, _classnames["default"])('time-range-slider__control', {
disabled: !isAnimatable
})
}, _react["default"].createElement(_styledComponents2.ButtonGroup, null, _react["default"].createElement(IconButton, (0, _extends2["default"])({
className: "playback-control-button"
}, btnStyle, {
onClick: updateAnimationTime
}), _react["default"].createElement(_icons.Reset, {
height: buttonHeight
})), _react["default"].createElement(IconButton, (0, _extends2["default"])({}, btnStyle, {
className: (0, _classnames["default"])('playback-control-button', {
active: isAnimating
}),
onClick: isAnimating ? pauseAnimation : startAnimation
}), isAnimating ? _react["default"].createElement(_icons.Pause, {
height: buttonHeight
}) : _react["default"].createElement(_icons.Play, {
height: buttonHeight
}))));
};
return AnimationPlaybacks;
}
var _default = AnimationPlaybacksFactory;
exports["default"] = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL2NvbW1vbi9hbmltYXRpb24tY29udHJvbC9wbGF5YmFjay1jb250cm9scy5qcyJdLCJuYW1lcyI6WyJTdHlsZWRBbmltYXRpb25Db250cm9scyIsInN0eWxlZCIsImRpdiIsIkljb25CdXR0b24iLCJCdXR0b24iLCJub3AiLCJERUZBVUxUX0JVVFRPTl9IRUlHSFQiLCJBbmltYXRpb25QbGF5YmFja3NGYWN0b3J5IiwiQW5pbWF0aW9uUGxheWJhY2tzIiwiaXNBbmltYXRhYmxlIiwiaXNBbmltYXRpbmciLCJidXR0b25TdHlsZSIsInBhdXNlQW5pbWF0aW9uIiwidXBkYXRlQW5pbWF0aW9uVGltZSIsInN0YXJ0QW5pbWF0aW9uIiwiYnV0dG9uSGVpZ2h0IiwiYnRuU3R5bGUiLCJkaXNhYmxlZCIsImFjdGl2ZSJdLC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IERFRkFVTFRfQlVUVE9OX0hFSUdIVFxuICB9KSA9PiB7XG4gICAgY29uc3QgYnRuU3R5bGUgPSBidXR0b25TdHlsZSA/IHtbYnV0dG9uU3R5bGVdOiB0cnVlfSA6IHt9O1xuICAgIHJldHVybiAoXG4gICAgICA8U3R5bGVkQW5pbWF0aW9uQ29udHJvbHNcbiAgICAgICAgY2xhc3NOYW1lPXtjbGFzc25hbWVzKCd0aW1lLXJhbmdlLXNsaWRlcl9fY29udHJvbCcsIHtcbiAgICAgICAgICBkaXNhYmxlZDogIWlzQW5pbWF0YWJsZVxuICAgICAgICB9KX1cbiAgICAgID5cbiAgICAgICAgPEJ1dHRvbkdyb3VwPlxuICAgICAgICAgIDxJY29uQnV0dG9uXG4gICAgICAgICAgICBjbGFzc05hbWU9XCJwbGF5YmFjay1jb250cm9sLWJ1dHRvblwiXG4gICAgICAgICAgICB7Li4uYnRuU3R5bGV9XG4gICAgICAgICAgICBvbkNsaWNrPXt1cGRhdGVBbmltYXRpb25UaW1lfVxuICAgICAgICAgID5cbiAgICAgICAgICAgIDxSZXNldCBoZWlnaHQ9e2J1dHRvbkhlaWdodH0gLz5cbiAgICAgICAgICA8L0ljb25CdXR0b24+XG4gICAgICAgICAgPEljb25CdXR0b25cbiAgICAgICAgICAgIHsuLi5idG5TdHlsZX1cbiAgICAgICAgICAgIGNsYXNzTmFtZT17Y2xhc3NuYW1lcygncGxheWJhY2stY29udHJvbC1idXR0b24nLCB7YWN0aXZlOiBpc0FuaW1hdGluZ30pfVxuICAgICAgICAgICAgb25DbGljaz17aXNBbmltYXRpbmcgPyBwYXVzZUFuaW1hdGlvbiA6IHN0YXJ0QW5pbWF0aW9ufVxuICAgICAgICAgID5cbiAgICAgICAgICAgIHtpc0FuaW1hdGluZyA/IDxQYXVzZSBoZWlnaHQ9e2J1dHRvbkhlaWdodH0gLz4gOiA8UGxheSBoZWlnaHQ9e2J1dHRvbkhlaWdodH0gLz59XG4gICAgICAgICAgPC9JY29uQnV0dG9uPlxuICAgICAgICA8L0J1dHRvbkdyb3VwPlxuICAgICAgPC9TdHlsZWRBbmltYXRpb25Db250cm9scz5cbiAgICApO1xuICB9O1xuICByZXR1cm4gQW5pbWF0aW9uUGxheWJhY2tzO1xufVxuXG5leHBvcnQgZGVmYXVsdCBBbmltYXRpb25QbGF5YmFja3NGYWN0b3J5O1xuIl19