From ec2852440a40c3a548a701ca13fc68f6078b64a1 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 28 Oct 2021 15:37:57 +0100 Subject: [PATCH] Remove references to `static` mode --- debug/app.js | 18 ------------- debug/index.html | 1 - docs/EXAMPLES.md | 53 +++++--------------------------------- src/constants.js | 3 +-- src/lib/theme.js | 66 +++++------------------------------------------- 5 files changed, 14 insertions(+), 127 deletions(-) diff --git a/debug/app.js b/debug/app.js index c83df4a0c..c72c5a993 100644 --- a/debug/app.js +++ b/debug/app.js @@ -1,16 +1,5 @@ /* global mapboxgl, MapboxGeocoder, MapboxDraw */ -const StaticMode = {}; - -StaticMode.onSetup = function() { - this.setActionableState(); // default actionable state is false for all actions - return {}; -}; - -StaticMode.toDisplayFeatures = function(state, geojson, display) { - display(geojson); -}; - // Parse the access_token out of the url const args = location.search.replace(/^\?/, '').split('&').reduce((o, param) => { const keyvalue = param.split('='); @@ -34,7 +23,6 @@ map.addControl(new MapboxGeocoder({ map.addControl(new mapboxgl.NavigationControl(), 'top-left'); const modes = MapboxDraw.modes; -modes.static = StaticMode; const Draw = window.Draw = new MapboxDraw({ modes }); let drawIsActive = true; map.addControl(Draw, 'bottom-right'); @@ -99,10 +87,4 @@ map.on('load', () => { Draw.changeMode('draw_polygon'); }; - // Jump into static mode via a custom UI element - const startStatic = document.getElementById('start-static'); - startStatic.onclick = function() { - Draw.changeMode('static'); - }; - }); diff --git a/debug/index.html b/debug/index.html index 2b0f4309e..e5519f20c 100644 --- a/debug/index.html +++ b/debug/index.html @@ -37,7 +37,6 @@
-
STATIC
POINT
LINE
POLYGON
diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 83f94ecfb..a0e66c747 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -42,7 +42,7 @@ mapbox.Draw({ ### lines and polygons -With this style, all line and polygon features are have dashed red outline and transparent fill while being drawn, including the point vertices. When the Draw mode is changed the 'static', these features will be drawn with solid black outline and transparent fill. Point vertices use the same point filter, and render these points twice: once as a larger-radius halo, and again as the vertex inset point. +With this style, all line and polygon features are have dashed red outline and transparent fill while being drawn, including the point vertices. Point vertices use the same point filter, and render these points twice: once as a larger-radius halo, and again as the vertex inset point. ```js mapbox.Draw({ @@ -52,7 +52,7 @@ mapbox.Draw({ { "id": "gl-draw-line", "type": "line", - "filter": ["all", ["==", "$type", "LineString"], ["!=", "mode", "static"]], + "filter": ["all", ["==", "$type", "LineString"]], "layout": { "line-cap": "round", "line-join": "round" @@ -67,7 +67,7 @@ mapbox.Draw({ { "id": "gl-draw-polygon-fill", "type": "fill", - "filter": ["all", ["==", "$type", "Polygon"], ["!=", "mode", "static"]], + "filter": ["all", ["==", "$type", "Polygon"]], "paint": { "fill-color": "#D20C0C", "fill-outline-color": "#D20C0C", @@ -90,7 +90,7 @@ mapbox.Draw({ { "id": "gl-draw-polygon-stroke-active", "type": "line", - "filter": ["all", ["==", "$type", "Polygon"], ["!=", "mode", "static"]], + "filter": ["all", ["==", "$type", "Polygon"]], "layout": { "line-cap": "round", "line-join": "round" @@ -105,7 +105,7 @@ mapbox.Draw({ { "id": "gl-draw-polygon-and-line-vertex-halo-active", "type": "circle", - "filter": ["all", ["==", "meta", "vertex"], ["==", "$type", "Point"], ["!=", "mode", "static"]], + "filter": ["all", ["==", "meta", "vertex"], ["==", "$type", "Point"]], "paint": { "circle-radius": 5, "circle-color": "#FFF" @@ -115,52 +115,11 @@ mapbox.Draw({ { "id": "gl-draw-polygon-and-line-vertex-active", "type": "circle", - "filter": ["all", ["==", "meta", "vertex"], ["==", "$type", "Point"], ["!=", "mode", "static"]], + "filter": ["all", ["==", "meta", "vertex"], ["==", "$type", "Point"]], "paint": { "circle-radius": 3, "circle-color": "#D20C0C", } - }, - - // INACTIVE (static, already drawn) - // line stroke - { - "id": "gl-draw-line-static", - "type": "line", - "filter": ["all", ["==", "$type", "LineString"], ["==", "mode", "static"]], - "layout": { - "line-cap": "round", - "line-join": "round" - }, - "paint": { - "line-color": "#000", - "line-width": 3 - } - }, - // polygon fill - { - "id": "gl-draw-polygon-fill-static", - "type": "fill", - "filter": ["all", ["==", "$type", "Polygon"], ["==", "mode", "static"]], - "paint": { - "fill-color": "#000", - "fill-outline-color": "#000", - "fill-opacity": 0.1 - } - }, - // polygon outline - { - "id": "gl-draw-polygon-stroke-static", - "type": "line", - "filter": ["all", ["==", "$type", "Polygon"], ["==", "mode", "static"]], - "layout": { - "line-cap": "round", - "line-join": "round" - }, - "paint": { - "line-color": "#000", - "line-width": 3 - } } ] }); diff --git a/src/constants.js b/src/constants.js index 14cc3516f..c22a18b82 100644 --- a/src/constants.js +++ b/src/constants.js @@ -50,8 +50,7 @@ export const modes = { DRAW_POLYGON: 'draw_polygon', DRAW_POINT: 'draw_point', SIMPLE_SELECT: 'simple_select', - DIRECT_SELECT: 'direct_select', - STATIC: 'static' + DIRECT_SELECT: 'direct_select' }; export const events = { diff --git a/src/lib/theme.js b/src/lib/theme.js index 0eb848f7a..f6f735dbb 100644 --- a/src/lib/theme.js +++ b/src/lib/theme.js @@ -4,8 +4,7 @@ export default [ 'type': 'fill', 'filter': ['all', ['==', 'active', 'false'], - ['==', '$type', 'Polygon'], - ['!=', 'mode', 'static'] + ['==', '$type', 'Polygon'] ], 'paint': { 'fill-color': '#3bb2d0', @@ -39,8 +38,7 @@ export default [ 'type': 'line', 'filter': ['all', ['==', 'active', 'false'], - ['==', '$type', 'Polygon'], - ['!=', 'mode', 'static'] + ['==', '$type', 'Polygon'] ], 'layout': { 'line-cap': 'round', @@ -70,8 +68,7 @@ export default [ 'type': 'line', 'filter': ['all', ['==', 'active', 'false'], - ['==', '$type', 'LineString'], - ['!=', 'mode', 'static'] + ['==', '$type', 'LineString'] ], 'layout': { 'line-cap': 'round', @@ -104,8 +101,7 @@ export default [ 'type': 'circle', 'filter': ['all', ['==', 'meta', 'vertex'], - ['==', '$type', 'Point'], - ['!=', 'mode', 'static'] + ['==', '$type', 'Point'] ], 'paint': { 'circle-radius': 5, @@ -117,8 +113,7 @@ export default [ 'type': 'circle', 'filter': ['all', ['==', 'meta', 'vertex'], - ['==', '$type', 'Point'], - ['!=', 'mode', 'static'] + ['==', '$type', 'Point'] ], 'paint': { 'circle-radius': 3, @@ -131,8 +126,7 @@ export default [ 'filter': ['all', ['==', 'active', 'false'], ['==', '$type', 'Point'], - ['==', 'meta', 'feature'], - ['!=', 'mode', 'static'] + ['==', 'meta', 'feature'] ], 'paint': { 'circle-radius': 5, @@ -146,8 +140,7 @@ export default [ 'filter': ['all', ['==', 'active', 'false'], ['==', '$type', 'Point'], - ['==', 'meta', 'feature'], - ['!=', 'mode', 'static'] + ['==', 'meta', 'feature'] ], 'paint': { 'circle-radius': 3, @@ -178,50 +171,5 @@ export default [ 'circle-radius': 5, 'circle-color': '#fbb03b' } - }, - { - 'id': 'gl-draw-polygon-fill-static', - 'type': 'fill', - 'filter': ['all', ['==', 'mode', 'static'], ['==', '$type', 'Polygon']], - 'paint': { - 'fill-color': '#404040', - 'fill-outline-color': '#404040', - 'fill-opacity': 0.1 - } - }, - { - 'id': 'gl-draw-polygon-stroke-static', - 'type': 'line', - 'filter': ['all', ['==', 'mode', 'static'], ['==', '$type', 'Polygon']], - 'layout': { - 'line-cap': 'round', - 'line-join': 'round' - }, - 'paint': { - 'line-color': '#404040', - 'line-width': 2 - } - }, - { - 'id': 'gl-draw-line-static', - 'type': 'line', - 'filter': ['all', ['==', 'mode', 'static'], ['==', '$type', 'LineString']], - 'layout': { - 'line-cap': 'round', - 'line-join': 'round' - }, - 'paint': { - 'line-color': '#404040', - 'line-width': 2 - } - }, - { - 'id': 'gl-draw-point-static', - 'type': 'circle', - 'filter': ['all', ['==', 'mode', 'static'], ['==', '$type', 'Point']], - 'paint': { - 'circle-radius': 5, - 'circle-color': '#404040' - } } ];