Skip to content

Commit 7a97f77

Browse files
shadab-skhanShadab Khan
andauthored
Added prop to hide toolbar (#890)
Co-authored-by: Shadab Khan <[email protected]>
1 parent c713add commit 7a97f77

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

react/src/demo/example-data/deckgl-map.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
],
2424
"horizontal": false
2525
},
26+
"toolbar": {
27+
"visible": true
28+
},
2629
"coordinateUnit": "m",
2730
"resources": {
2831
"propertyMap": "https://raw.githubusercontent.com/equinor/webviz-subsurface-components/master/react/src/demo/example-data/propertyMap.png",
@@ -136,7 +139,7 @@
136139
},
137140
{
138141
"@@type": "DrawingLayer"
139-
}
142+
}
140143
],
141144
"editedData": {},
142145
"views": {

react/src/lib/components/DeckGLMap/DeckGLMap.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ interface DeckGLMapProps {
2929
position?: number[] | null;
3030
};
3131
coordinateUnit?: string;
32+
toolbar?: {
33+
visible?: boolean | null;
34+
};
3235
legend?: {
3336
visible?: boolean | null;
3437
position?: number[] | null;
@@ -50,6 +53,7 @@ const DeckGLMap: React.FC<DeckGLMapProps> = ({
5053
scale,
5154
coordinateUnit,
5255
legend,
56+
toolbar,
5357
colorTables,
5458
editedData,
5559
setProps,
@@ -115,6 +119,7 @@ const DeckGLMap: React.FC<DeckGLMapProps> = ({
115119
coords={coords}
116120
scale={scale}
117121
coordinateUnit={coordinateUnit}
122+
toolbar={toolbar}
118123
legend={legend}
119124
colorTables={colorTables}
120125
editedData={editedData}
@@ -253,6 +258,16 @@ DeckGLMap.propTypes = {
253258
*/
254259
coordinateUnit: PropTypes.string,
255260

261+
/**
262+
* Parameters to control toolbar
263+
*/
264+
toolbar: PropTypes.shape({
265+
/**
266+
* Toggle toolbar visibility
267+
*/
268+
visible: PropTypes.bool,
269+
}),
270+
256271
/**
257272
* Parameters for the legend
258273
*/

react/src/lib/components/DeckGLMap/components/Map.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ export interface MapProps {
125125

126126
coordinateUnit?: string;
127127

128+
/**
129+
* Parameters to control toolbar
130+
*/
131+
toolbar?: {
132+
visible?: boolean | null;
133+
};
134+
128135
legend?: {
129136
visible?: boolean | null;
130137
position?: number[] | null;
@@ -158,6 +165,7 @@ const Map: React.FC<MapProps> = ({
158165
coords,
159166
scale,
160167
coordinateUnit,
168+
toolbar,
161169
legend,
162170
colorTables,
163171
editedData,
@@ -327,10 +335,12 @@ const Map: React.FC<MapProps> = ({
327335
colorTables={colorTables}
328336
/>
329337
)}
330-
<Settings
331-
viewportId={view.id}
332-
layerIds={view.layerIds}
333-
/>
338+
{toolbar?.visible && (
339+
<Settings
340+
viewportId={view.id}
341+
layerIds={view.layerIds}
342+
/>
343+
)}
334344
{views.showLabel && (
335345
<ViewFooter>
336346
{`${
@@ -377,6 +387,9 @@ Map.defaultProps = {
377387
widthPerUnit: 100,
378388
position: [10, 10],
379389
},
390+
toolbar: {
391+
visible: true,
392+
},
380393
legend: {
381394
visible: true,
382395
position: [5, 10],

react/src/lib/components/DeckGLMap/storybook/DeckGLMap.stories.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ KhMapMesh.args = {
289289
...meshMapLayer,
290290
},
291291
],
292+
toolbar: {
293+
visible: false,
294+
},
292295
bounds: [432150, 6475800, 439400, 6481500],
293296
views: {
294297
layout: [1, 1],
@@ -335,6 +338,9 @@ GridLayer.args = {
335338
visible: true,
336339
},
337340
],
341+
toolbar: {
342+
visible: false,
343+
},
338344
views: {
339345
layout: [1, 1],
340346
viewports: [

0 commit comments

Comments
 (0)