mirror of
https://github.com/heavyai/heavyai-charting.git
synced 2026-02-01 16:00:04 +00:00
[FE-18172] Listen for esc key on map root, close ruler if active (#695)
This commit is contained in:
parent
73dbe9aa12
commit
da4963486a
12
dist/charting.js
vendored
12
dist/charting.js
vendored
@ -38715,12 +38715,20 @@ function mapMixin(_chart, chartDivId, _mapboxgl) {
|
||||
});
|
||||
_map.dragRotate.disable();
|
||||
_map.touchZoomRotate.disableRotation();
|
||||
_map.addControl(new __WEBPACK_IMPORTED_MODULE_5__mapbox_controls_ruler__["a" /* default */]({
|
||||
var rulerControl = new __WEBPACK_IMPORTED_MODULE_5__mapbox_controls_ruler__["a" /* default */]({
|
||||
linePaint: {
|
||||
"line-color": "#999",
|
||||
"line-width": 2
|
||||
}
|
||||
}), "bottom-right");
|
||||
});
|
||||
_map.addControl(rulerControl, "bottom-right");
|
||||
_chart.root().on("keydown", function () {
|
||||
if (__WEBPACK_IMPORTED_MODULE_0_d3___default.a.event.key === "Escape" || __WEBPACK_IMPORTED_MODULE_0_d3___default.a.event.key === 27) {
|
||||
if (rulerControl !== null && rulerControl !== void 0 && rulerControl.isActive) {
|
||||
rulerControl.deactivate();
|
||||
}
|
||||
}
|
||||
});
|
||||
_map.addControl(new _mapboxgl.NavigationControl(), "bottom-right");
|
||||
_map.addControl(new _mapboxgl.AttributionControl(), _attribLocation);
|
||||
_map.addControl(new _mapboxgl.ScaleControl({
|
||||
|
||||
@ -738,15 +738,21 @@ export default function mapMixin(
|
||||
_map.dragRotate.disable()
|
||||
_map.touchZoomRotate.disableRotation()
|
||||
|
||||
_map.addControl(
|
||||
new RulerControl({
|
||||
linePaint: {
|
||||
"line-color": "#999",
|
||||
"line-width": 2
|
||||
const rulerControl = new RulerControl({
|
||||
linePaint: {
|
||||
"line-color": "#999",
|
||||
"line-width": 2
|
||||
}
|
||||
})
|
||||
_map.addControl(rulerControl, "bottom-right")
|
||||
|
||||
_chart.root().on("keydown", () => {
|
||||
if (d3.event.key === "Escape" || d3.event.key === 27) {
|
||||
if (rulerControl?.isActive) {
|
||||
rulerControl.deactivate()
|
||||
}
|
||||
}),
|
||||
"bottom-right"
|
||||
)
|
||||
}
|
||||
})
|
||||
_map.addControl(new _mapboxgl.NavigationControl(), "bottom-right")
|
||||
_map.addControl(new _mapboxgl.AttributionControl(), _attribLocation)
|
||||
_map.addControl(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user