From 3f9f4aedd392c378ec61c2405d85f4268bb51ea7 Mon Sep 17 00:00:00 2001 From: Stepan Kuzmin Date: Fri, 28 Jun 2024 17:55:54 +0300 Subject: [PATCH 1/3] Keep dashed line in theme for active state --- src/lib/theme.js | 5 +++++ test/utils/create_map.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/theme.js b/src/lib/theme.js index 3576146b2..0f45b7d16 100644 --- a/src/lib/theme.js +++ b/src/lib/theme.js @@ -46,6 +46,11 @@ export default [ ['==', ['get', 'active'], 'true'], orange, blue, ], + 'line-dasharray': [ + 'case', + ['==', ['get', 'active'], 'true'], [0.2, 2], + [2, 0], + ], 'line-width': 2, }, }, diff --git a/test/utils/create_map.js b/test/utils/create_map.js index a0e23fbaf..fa96aaa6d 100644 --- a/test/utils/create_map.js +++ b/test/utils/create_map.js @@ -1,4 +1,4 @@ -import bboxClip from '@turf/bbox-clip'; +import {bboxClip} from '@turf/bbox-clip'; import Evented from '../../bench/lib/evented.js'; import { interactions } from '../../src/constants.js'; From 415736d748a386236cd677d8827ca4250606eec0 Mon Sep 17 00:00:00 2001 From: Stepan Kuzmin Date: Fri, 28 Jun 2024 17:58:12 +0300 Subject: [PATCH 2/3] fixup --- test/fixtures/style_with_sources.json | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/fixtures/style_with_sources.json b/test/fixtures/style_with_sources.json index 9b995727c..32e4e4c65 100644 --- a/test/fixtures/style_with_sources.json +++ b/test/fixtures/style_with_sources.json @@ -62,6 +62,25 @@ "#fbb03b", "#3bb2d0" ], + "line-dasharray": [ + "case", + [ + "==", + [ + "get", + "active" + ], + "true" + ], + [ + 0.2, + 2 + ], + [ + 2, + 0 + ] + ], "line-width": 2 }, "source": "mapbox-gl-draw-cold" @@ -304,6 +323,25 @@ "#fbb03b", "#3bb2d0" ], + "line-dasharray": [ + "case", + [ + "==", + [ + "get", + "active" + ], + "true" + ], + [ + 0.2, + 2 + ], + [ + 2, + 0 + ] + ], "line-width": 2 }, "source": "mapbox-gl-draw-hot" From ca0ee425b7ca2d1daf99a87bbc9fc0b4b7a0c737 Mon Sep 17 00:00:00 2001 From: Stepan Kuzmin Date: Fri, 28 Jun 2024 18:01:33 +0300 Subject: [PATCH 3/3] Drop map.fire monkey patch We no longer need this patch since we support both map.fire interfaces in GL JS --- rollup.config.js | 5 ----- src/setup.js | 16 ---------------- 2 files changed, 21 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 21a10b84e..2a271b7dd 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,7 +3,6 @@ const minified = MINIFY === 'true'; const outputFile = minified ? 'dist/mapbox-gl-draw.js' : 'dist/mapbox-gl-draw-unminified.js'; import commonjs from '@rollup/plugin-commonjs'; -import replace from '@rollup/plugin-replace'; import resolve from '@rollup/plugin-node-resolve'; import terser from '@rollup/plugin-terser'; @@ -18,10 +17,6 @@ export default { }, treeshake: true, plugins: [ - replace({ - 'process.env.NODE_ENV': "'browser'", - preventAssignment: true - }), minified ? terser({ ecma: 2020, module: true, diff --git a/src/setup.js b/src/setup.js index ee696900e..6e553a473 100644 --- a/src/setup.js +++ b/src/setup.js @@ -37,22 +37,6 @@ export default function(ctx) { ctx.events.addEventListeners(); }, onAdd(map) { - if (process.env.NODE_ENV !== 'test') { - // Monkey patch to resolve breaking change to `fire` introduced by - // mapbox-gl-js. See mapbox/mapbox-gl-draw/issues/766. - const _fire = map.fire; - map.fire = function(type, event) { - // eslint-disable-next-line - let args = arguments; - - if (_fire.length === 1 && arguments.length !== 1) { - args = [Object.assign({}, { type }, event)]; - } - - return _fire.apply(map, args); - }; - } - ctx.map = map; ctx.events = events(ctx); ctx.ui = ui(ctx);