kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
151 lines (148 loc) • 23.3 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = useLegendPosition;
exports.useCalcLegendPosition = useCalcLegendPosition;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = require("react");
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
var MARGIN = {
left: 10,
top: 10,
right: 10,
bottom: 30
};
var DEFAULT_POSITION = {
x: MARGIN.right,
y: MARGIN.bottom,
anchorX: 'right',
anchorY: 'bottom'
};
var MIN_CONTENT_HEIGHT = 100;
function useCalcLegendPosition(_ref) {
var legendContentRef = _ref.legendContentRef,
isSidePanelShown = _ref.isSidePanelShown,
sidePanelWidth = _ref.sidePanelWidth;
return (0, _react.useCallback)(function () {
var _legendContentRef$cur;
var root = (_legendContentRef$cur = legendContentRef.current) === null || _legendContentRef$cur === void 0 ? void 0 : _legendContentRef$cur.closest('.kepler-gl');
var legendContent = legendContentRef.current;
if (!legendContent || !(root instanceof HTMLElement)) {
return DEFAULT_POSITION;
}
var legendRect = legendContent.getBoundingClientRect();
var mapRootBounds = root.getBoundingClientRect();
var leftSidebarOffset = isSidePanelShown ? sidePanelWidth : 0;
var leftOffset = Math.max(MARGIN.left, legendRect.left - mapRootBounds.left - leftSidebarOffset);
var rightOffset = Math.max(MARGIN.right, mapRootBounds.right - legendRect.right);
var topOffset = Math.max(MARGIN.top, legendRect.top);
var bottomOffset = Math.max(MARGIN.bottom, mapRootBounds.bottom - legendRect.bottom);
return _objectSpread(_objectSpread({}, leftOffset < rightOffset ? {
x: leftOffset + leftSidebarOffset,
anchorX: 'left'
} : {
x: rightOffset,
anchorX: 'right'
}), topOffset < bottomOffset ? {
y: topOffset,
anchorY: 'top'
} : {
y: bottomOffset,
anchorY: 'bottom'
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isSidePanelShown, sidePanelWidth]);
}
/**
* Returns a function that calculates the anchored position of the map legend
* that is being dragged.
*/
function useLegendPosition(_ref2) {
var _settings$position, _settings$contentHeig, _theme$sidePanel;
var legendContentRef = _ref2.legendContentRef,
isSidePanelShown = _ref2.isSidePanelShown,
settings = _ref2.settings,
onChangeSettings = _ref2.onChangeSettings,
theme = _ref2.theme;
var pos = (_settings$position = settings === null || settings === void 0 ? void 0 : settings.position) !== null && _settings$position !== void 0 ? _settings$position : DEFAULT_POSITION;
var contentHeight = (_settings$contentHeig = settings === null || settings === void 0 ? void 0 : settings.contentHeight) !== null && _settings$contentHeig !== void 0 ? _settings$contentHeig : -1;
var positionStyles = (0, _react.useMemo)(function () {
return (0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, pos.anchorX, pos.x), pos.anchorY, pos.y);
}, [pos]);
var startHeightRef = (0, _react.useRef)(0);
var sidePanelWidth = ((_theme$sidePanel = theme.sidePanel) === null || _theme$sidePanel === void 0 ? void 0 : _theme$sidePanel.width) || 0;
var calcPosition = useCalcLegendPosition({
legendContentRef: legendContentRef,
isSidePanelShown: isSidePanelShown,
sidePanelWidth: sidePanelWidth
});
var updatePosition = (0, _react.useCallback)(function () {
return onChangeSettings({
position: calcPosition()
});
}, [calcPosition, onChangeSettings]);
var startResize = (0, _react.useCallback)(function () {
var _legendContentRef$cur2;
var content = (_legendContentRef$cur2 = legendContentRef.current) === null || _legendContentRef$cur2 === void 0 ? void 0 : _legendContentRef$cur2.querySelector('.map-control__panel-content');
if (content instanceof HTMLElement) {
startHeightRef.current = content.offsetHeight;
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
var resize = (0, _react.useCallback)(function (deltaY) {
var _legendContentRef$cur3;
var root = (_legendContentRef$cur3 = legendContentRef.current) === null || _legendContentRef$cur3 === void 0 ? void 0 : _legendContentRef$cur3.closest('.kepler-gl');
var legendContent = legendContentRef.current;
if (root instanceof HTMLElement && legendContent) {
var legendRect = legendContent.getBoundingClientRect();
var nextHeight = Math.min(root.offsetHeight - legendRect.top - 100, Math.max(MIN_CONTENT_HEIGHT, startHeightRef.current + deltaY));
onChangeSettings({
contentHeight: nextHeight
});
if (contentHeight > 0 && pos.anchorY === 'bottom') {
onChangeSettings({
position: _objectSpread(_objectSpread({}, pos), {}, {
y: pos.y - (nextHeight - contentHeight)
})
});
}
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[contentHeight, pos, onChangeSettings]);
// Shift when side panel is shown/hidden
var posRef = (0, _react.useRef)(pos);
posRef.current = pos;
(0, _react.useEffect)(function () {
var currentPos = posRef.current;
if (currentPos.anchorX === 'left') {
if (isSidePanelShown) {
if (currentPos.x <= sidePanelWidth + MARGIN.left) {
onChangeSettings({
position: _objectSpread(_objectSpread({}, currentPos), {}, {
x: sidePanelWidth + MARGIN.left
})
});
}
} else {
onChangeSettings({
position: _objectSpread(_objectSpread({}, currentPos), {}, {
x: Math.max(MARGIN.left, currentPos.x - sidePanelWidth)
})
});
}
}
}, [isSidePanelShown, onChangeSettings, sidePanelWidth]);
return {
positionStyles: positionStyles,
updatePosition: updatePosition,
contentHeight: contentHeight,
startResize: startResize,
resize: resize
};
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3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