kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
311 lines (252 loc) • 30.6 kB
JavaScript
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = exports.getChildPos = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf3 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireWildcard(require("react"));
var _lodash = _interopRequireDefault(require("lodash.debounce"));
var _lodash2 = _interopRequireDefault(require("lodash.isequal"));
var _exenv = require("exenv");
var _styledComponents = require("styled-components");
var _context = require("../context");
var _reactModal = _interopRequireDefault(require("react-modal"));
var _window = _interopRequireDefault(require("global/window"));
var _base = require("../../styles/base");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var listeners = {};
var startListening = function startListening() {
return Object.keys(listeners).forEach(function (key) {
return listeners[key]();
});
};
var getPageOffset = function getPageOffset() {
return {
x: _window["default"].pageXOffset !== undefined ? _window["default"].pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft,
y: _window["default"].pageYOffset !== undefined ? _window["default"].pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop
};
};
var addEventListeners = function addEventListeners() {
if (document && document.body) document.body.addEventListener('mousewheel', (0, _lodash["default"])(startListening, 100, true));
_window["default"].addEventListener('resize', (0, _lodash["default"])(startListening, 50, true));
};
var getChildPos = function getChildPos(_ref) {
var offsets = _ref.offsets,
rect = _ref.rect,
childRect = _ref.childRect,
pageOffset = _ref.pageOffset,
padding = _ref.padding;
var topOffset = offsets.topOffset,
leftOffset = offsets.leftOffset,
rightOffset = offsets.rightOffset;
var anchorLeft = leftOffset !== undefined;
var pos = _objectSpread({
top: pageOffset.y + rect.top + (topOffset || 0)
}, anchorLeft ? {
left: pageOffset.x + rect.left + leftOffset
} : {
right: _window["default"].innerWidth - rect.right - pageOffset.x + (rightOffset || 0)
});
var leftOrRight = anchorLeft ? 'left' : 'right';
if (pos[leftOrRight] && pos[leftOrRight] < 0) {
pos[leftOrRight] = padding;
} else if (pos[leftOrRight] && pos[leftOrRight] + childRect.width > _window["default"].innerWidth) {
pos[leftOrRight] = _window["default"].innerWidth - childRect.width - padding;
}
if (pos.top < 0) {
pos.top = padding;
} else if (pos.top + childRect.height > _window["default"].innerHeight) {
pos.top = _window["default"].innerHeight - childRect.height - padding;
}
return pos;
};
exports.getChildPos = getChildPos;
if (_exenv.canUseDOM) {
if (document.body) {
addEventListeners();
} else {
document.addEventListener('DOMContentLoaded', addEventListeners);
}
}
var listenerIdCounter = 0;
function subscribe(fn) {
listenerIdCounter += 1;
var id = listenerIdCounter;
listeners[id] = fn;
return function () {
return delete listeners[id];
};
}
var defaultModalStyle = {
content: {
top: 0,
left: 0,
border: 0,
right: 'auto',
bottom: 'auto',
padding: '0px 0px 0px 0px'
},
overlay: {
right: 'auto',
bottom: 'auto',
width: '100vw',
height: '100vh',
backgroundColor: 'rgba(0, 0, 0, 0)'
}
};
var WINDOW_PAD = 40;
var noop = function noop() {};
var Portaled =
/*#__PURE__*/
function (_Component) {
(0, _inherits2["default"])(Portaled, _Component);
function Portaled() {
var _getPrototypeOf2;
var _this;
(0, _classCallCheck2["default"])(this, Portaled);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = (0, _possibleConstructorReturn2["default"])(this, (_getPrototypeOf2 = (0, _getPrototypeOf3["default"])(Portaled)).call.apply(_getPrototypeOf2, [this].concat(args)));
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
pos: null,
isVisible: false
});
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "element", (0, _react.createRef)());
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "child", (0, _react.createRef)());
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleScroll", function () {
if (_this.child.current) {
var rect = _this.element.current.getBoundingClientRect();
var childRect = _this.child.current && _this.child.current.getBoundingClientRect();
var pageOffset = getPageOffset();
var _this$props = _this.props,
topOffset = _this$props.top,
leftOffset = _this$props.left,
rightOffset = _this$props.right;
var pos = getChildPos({
offsets: {
topOffset: topOffset,
leftOffset: leftOffset,
rightOffset: rightOffset
},
rect: rect,
childRect: childRect,
pageOffset: pageOffset,
padding: WINDOW_PAD
});
if (!(0, _lodash2["default"])(pos, _this.state.pos)) {
_this.setState({
pos: pos
});
}
}
});
return _this;
}
(0, _createClass2["default"])(Portaled, [{
key: "componentDidMount",
value: function componentDidMount() {
// relative
this.unsubscribe = subscribe(this.handleScroll);
this.handleScroll();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var _this2 = this;
var didOpen = this.props.isOpened && !prevProps.isOpened;
var didClose = !this.props.isOpened && prevProps.isOpened;
if (didOpen || didClose) {
_window["default"].requestAnimationFrame(function () {
if (_this2._unmounted) return;
_this2.setState({
isVisible: didOpen
});
});
}
this.handleScroll();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this._unmounted = true;
this.unsubscribe();
}
}, {
key: "render",
value: function render() {
var _this3 = this;
var _this$props2 = this.props,
Comp = _this$props2.component,
overlayZIndex = _this$props2.overlayZIndex,
isOpened = _this$props2.isOpened,
onClose = _this$props2.onClose,
children = _this$props2.children,
modalProps = _this$props2.modalProps;
var _this$state = this.state,
isVisible = _this$state.isVisible,
pos = _this$state.pos;
var modalStyle = _objectSpread({}, defaultModalStyle, {
overlay: _objectSpread({}, defaultModalStyle.overlay, {
// needs to be on top of existing modal
zIndex: overlayZIndex || 9999
})
});
return _react["default"].createElement(_context.RootContext.Consumer, null, function (context) {
return _react["default"].createElement(Comp, {
ref: _this3.element
}, isOpened ? _react["default"].createElement(_reactModal["default"], (0, _extends2["default"])({
className: "modal-portal"
}, modalProps, {
ariaHideApp: false,
isOpen: true,
style: modalStyle,
parentSelector: function parentSelector() {
// React modal issue: https://github.com/reactjs/react-modal/issues/769
// failed to execute removeChild on parent node when it is already unmounted
return context && context.current || {
removeChild: function removeChild() {},
appendChild: function appendChild() {}
};
},
onRequestClose: onClose
}), _react["default"].createElement("div", {
className: "portaled-content",
key: "item",
style: _objectSpread({
position: 'fixed',
opacity: isVisible ? 1 : 0,
top: _this3.state.top,
transition: _this3.props.theme.transition,
marginTop: isVisible ? '0px' : '14px'
}, pos)
}, _react["default"].createElement("div", {
ref: _this3.child,
style: {
position: 'absolute',
zIndex: overlayZIndex ? overlayZIndex + 1 : 10000
}
}, children))) : null);
});
}
}]);
return Portaled;
}(_react.Component);
(0, _defineProperty2["default"])(Portaled, "defaultProps", {
component: 'div',
onClose: noop,
theme: _base.theme
});
var _default = (0, _styledComponents.withTheme)(Portaled);
exports["default"] = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL2NvbW1vbi9wb3J0YWxlZC5qcyJdLCJuYW1lcyI6WyJsaXN0ZW5lcnMiLCJzdGFydExpc3RlbmluZyIsIk9iamVjdCIsImtleXMiLCJmb3JFYWNoIiwia2V5IiwiZ2V0UGFnZU9mZnNldCIsIngiLCJ3aW5kb3ciLCJwYWdlWE9mZnNldCIsInVuZGVmaW5lZCIsImRvY3VtZW50IiwiZG9jdW1lbnRFbGVtZW50IiwiYm9keSIsInBhcmVudE5vZGUiLCJzY3JvbGxMZWZ0IiwieSIsInBhZ2VZT2Zmc2V0Iiwic2Nyb2xsVG9wIiwiYWRkRXZlbnRMaXN0ZW5lcnMiLCJhZGRFdmVudExpc3RlbmVyIiwiZ2V0Q2hpbGRQb3MiLCJvZmZzZXRzIiwicmVjdCIsImNoaWxkUmVjdCIsInBhZ2VPZmZzZXQiLCJwYWRkaW5nIiwidG9wT2Zmc2V0IiwibGVmdE9mZnNldCIsInJpZ2h0T2Zmc2V0IiwiYW5jaG9yTGVmdCIsInBvcyIsInRvcCIsImxlZnQiLCJyaWdodCIsImlubmVyV2lkdGgiLCJsZWZ0T3JSaWdodCIsIndpZHRoIiwiaGVpZ2h0IiwiaW5uZXJIZWlnaHQiLCJjYW5Vc2VET00iLCJsaXN0ZW5lcklkQ291bnRlciIsInN1YnNjcmliZSIsImZuIiwiaWQiLCJkZWZhdWx0TW9kYWxTdHlsZSIsImNvbnRlbnQiLCJib3JkZXIiLCJib3R0b20iLCJvdmVybGF5IiwiYmFja2dyb3VuZENvbG9yIiwiV0lORE9XX1BBRCIsIm5vb3AiLCJQb3J0YWxlZCIsImlzVmlzaWJsZSIsImNoaWxkIiwiY3VycmVudCIsImVsZW1lbnQiLCJnZXRCb3VuZGluZ0NsaWVudFJlY3QiLCJwcm9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Bvc30pO1xuICAgICAgfVxuICAgIH1cbiAgfTtcblxuICByZW5kZXIoKSB7XG4gICAgY29uc3Qge1xuICAgICAgLy8gcmVsYXRpdmVcbiAgICAgIGNvbXBvbmVudDogQ29tcCxcbiAgICAgIG92ZXJsYXlaSW5kZXgsXG4gICAgICBpc09wZW5lZCxcbiAgICAgIG9uQ2xvc2UsXG5cbiAgICAgIC8vIE1vcmRhbFxuICAgICAgY2hpbGRyZW4sXG4gICAgICBtb2RhbFByb3BzXG4gICAgfSA9IHRoaXMucHJvcHM7XG5cbiAgICBjb25zdCB7aXNWaXNpYmxlLCBwb3N9ID0gdGhpcy5zdGF0ZTtcblxuICAgIGNvbnN0IG1vZGFsU3R5bGUgPSB7XG4gICAgICAuLi5kZWZhdWx0TW9kYWxTdHlsZSxcbiAgICAgIG92ZXJsYXk6IHtcbiAgICAgICAgLi4uZGVmYXVsdE1vZGFsU3R5bGUub3ZlcmxheSxcbiAgICAgICAgLy8gbmVlZHMgdG8gYmUgb24gdG9wIG9mIGV4aXN0aW5nIG1vZGFsXG4gICAgICAgIHpJbmRleDogb3ZlcmxheVpJbmRleCB8fCA5OTk5XG4gICAgICB9XG4gICAgfTtcblxuICAgIHJldHVybiAoXG4gICAgICA8Um9vdENvbnRleHQuQ29uc3VtZXI+XG4gICAgICAgIHtjb250ZXh0ID0+IChcbiAgICAgICAgICA8Q29tcCByZWY9e3RoaXMuZWxlbWVudH0+XG4gICAgICAgICAgICB7aXNPcGVuZWQgPyAoXG4gICAgICAgICAgICAgIDxNb2RhbFxuICAgICAgICAgICAgICAgIGNsYXNzTmFtZT1cIm1vZGFsLXBvcnRhbFwiXG4gICAgICAgICAgICAgICAgey4uLm1vZGFsUHJvcHN9XG4gICAgICAgICAgICAgICAgYXJpYUhpZGVBcHA9e2ZhbHNlfVxuICAgICAgICAgICAgICAgIGlzT3BlblxuICAgICAgICAgICAgICAgIHN0eWxlPXttb2RhbFN0eWxlfVxuICAgICAgICAgICAgICAgIHBhcmVudFNlbGVjdG9yPXsoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAvLyBSZWFjdCBtb2RhbCBpc3N1ZTogaHR0cHM6Ly9naXRodWIuY29tL3JlYWN0anMvcmVhY3QtbW9kYWwvaXNzdWVzLzc2OVxuICAgICAgICAgICAgICAgICAgLy8gZmFpbGVkIHRvIGV4ZWN1dGUgcmVtb3ZlQ2hpbGQgb24gcGFyZW50IG5vZGUgd2hlbiBpdCBpcyBhbHJlYWR5IHVubW91bnRlZFxuICAgICAgICAgICAgICAgICAgcmV0dXJuIChcbiAgICAgICAgICAgICAgICAgICAgKGNvbnRleHQgJiYgY29udGV4dC5jdXJyZW50KSB8fCB7XG4gICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlQ2hpbGQ6ICgpID0+IHt9LFxuICAgICAgICAgICAgICAgICAgICAgIGFwcGVuZENoaWxkOiAoKSA9PiB7fVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH19XG4gICAgICAgICAgICAgICAgb25SZXF1ZXN0Q2xvc2U9e29uQ2xvc2V9XG4gICAgICAgICAgICAgID5cbiAgICAgICAgICAgICAgICA8ZGl2XG4gICAgICAgICAgICAgICAgICBjbGFzc05hbWU9XCJwb3J0YWxlZC1jb250ZW50XCJcbiAgICAgICAgICAgICAgICAgIGtleT1cIml0ZW1cIlxuICAgICAgICAgICAgICAgICAgc3R5bGU9e3tcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb246ICdmaXhlZCcsXG4gICAgICAgICAgICAgICAgICAgIG9wYWNpdHk6IGlzVmlzaWJsZSA/IDEgOiAwLFxuICAgICAgICAgICAgICAgICAgICB0b3A6IHRoaXMuc3RhdGUudG9wLFxuICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uOiB0aGlzLnByb3BzLnRoZW1lLnRyYW5zaXRpb24sXG4gICAgICAgICAgICAgICAgICAgIG1hcmdpblRvcDogaXNWaXNpYmxlID8gJzBweCcgOiAnMTRweCcsXG4gICAgICAgICAgICAgICAgICAgIC4uLnBvc1xuICAgICAgICAgICAgICAgICAgfX1cbiAgICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAgICA8ZGl2XG4gICAgICAgICAgICAgICAgICAgIHJlZj17dGhpcy5jaGlsZH1cbiAgICAgICAgICAgICAgICAgICAgc3R5bGU9e3tcbiAgICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogJ2Fic29sdXRlJyxcbiAgICAgICAgICAgICAgICAgICAgICB6SW5kZXg6IG92ZXJsYXlaSW5kZXggPyBvdmVybGF5WkluZGV4ICsgMSA6IDEwMDAwXG4gICAgICAgICAgICAgICAgICAgIH19XG4gICAgICAgICAgICAgICAgICA+XG4gICAgICAgICAgICAgICAgICAgIHtjaGlsZHJlbn1cbiAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICA8L01vZGFsPlxuICAgICAgICAgICAgKSA6IG51bGx9XG4gICAgICAgICAgPC9Db21wPlxuICAgICAgICApfVxuICAgICAgPC9Sb290Q29udGV4dC5Db25zdW1lcj5cbiAgICApO1xuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IHdpdGhUaGVtZShQb3J0YWxlZCk7XG4iXX0=
;