You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-reference/core/widget.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,11 @@ The `Widget` class is a base class used to define new widgets and should not be
9
9
10
10
## Types
11
11
12
-
#### `WidgetProps` (object) {#props}
12
+
#### `WidgetProps` (object) {#widgetprops}
13
13
14
14
Options for the widget, as passed into the constructor and can be updated with `setProps`.
15
15
16
-
#### `id` {#id}
16
+
#### `id`(string) {#id}
17
17
18
18
The `id` string must be unique among all your widgets at a given time. While a default `id` is provided, it is recommended to set `id` explicitly if you have multiple widgets of the same type.
19
19
@@ -41,25 +41,25 @@ Widget positioning within the view. One of:
41
41
-`'bottom-right'`
42
42
-`'fill'`
43
43
44
-
#### `style`
44
+
#### `style` (object, optional) {#style}
45
45
46
-
CSS inline style overrides.
46
+
Additional inline CSS styles on the top HTML element.
47
47
48
48
```ts
49
49
style?:Partial<CSSStyleDeclaration>;
50
50
```
51
51
52
-
#### `className`
52
+
* Default: `{}`
53
53
54
-
Additional CSS classnames for interaction with custom stylesheets.
54
+
#### `className` (string, optional) {#classname}
55
+
56
+
Additional CSS classnames on the top HTML element.
55
57
56
-
```ts
57
-
className?:string;
58
-
```
58
+
* Default: `''`
59
59
60
60
### Methods for Widget Writers
61
61
62
-
#### `constructor`
62
+
#### `constructor` {#constructor}
63
63
64
64
Supply the props and default props to the base class.
65
65
@@ -71,7 +71,7 @@ Called to update widget options.
71
71
72
72
Updates the widget. Called by the specific widget when state has changed. Calls `onRenderHTML()`
73
73
74
-
#### `onRenderHTML`
74
+
#### `onRenderHTML` {#onrenderhtml}
75
75
76
76
This function is implemented by the specific widget subclass to update the HTML for the widget
The `ContextMenuWidget` accepts the generic [`WidgetProps`](../core/widget.md#widgetprops) and:
41
+
42
+
-`id` (string, default: `'context'`) - **Required.** Unique id for this widget
43
+
-`getMenuItems` (function) - **Required.** Function that returns menu items based on the picked object. Receives `PickingInfo` and returns an array of `ContextWidgetMenuItem` objects or `null`.
44
+
-`onMenuItemSelected` (function, optional) - Callback invoked when a menu item is selected. Receives the selected item key and `PickingInfo`.
45
+
-`visible` (boolean, default `false`) - Controls visibility of the context menu.
46
+
-`position` (object, default `{x: 0, y: 0}`) - Screen position where the menu appears.
47
+
-`menuItems` (array, default `[]`) - Current menu items to display.
Copy file name to clipboardExpand all lines: docs/api-reference/widgets/geocoder-widget.md
+29-6Lines changed: 29 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,6 @@
1
+
import {WidgetPreview} from '@site/src/doc-demos/widgets';
2
+
import {GeocoderWidget} from '@deck.gl/widgets';
3
+
1
4
# GeocoderWidget
2
5
3
6
The GeocoderWidget helps the user find positions on the map.
@@ -8,7 +11,7 @@ The user types an address or coordinates into the text field and press **Go** to
8
11
9
12
Addresses that return a valid location are stored in browser local storage (up to five entries). They will appear in the drop-down for quick re-use during later visits.
10
13
11
-
## Usage
14
+
<WidgetPreviewcls={GeocoderWidget}/>
12
15
13
16
```ts
14
17
import {GeocoderWidget} from'@deck.gl/widgets';
@@ -19,25 +22,45 @@ new Deck({
19
22
});
20
23
```
21
24
22
-
## Props
25
+
## Types
26
+
27
+
### `GeocoderWidgetProps` {#geocoderwidgetprops}
28
+
29
+
The `GeocoderWidgetProps` accepts the generic [`WidgetProps`](../core/widget.md#widgetprops):
30
+
31
+
-`id` (default `'geocoder'`) - Unique id for this widget
32
+
-`placement` (default `'top-left'`) - Widget position within the view relative to the map container
33
+
-`viewId` (default `null`) - The `viewId` prop controls how a widget interacts with views.
34
+
-`style` (default `{}`) - Additional inline styles on the top HTML element.
35
+
-`className` (default `''`) - Additional classnames on the top HTML element.
23
36
24
-
The `GeocoderWidget` shares the base properties listed on the [widget overview page](./overview.md). Additional options are listed below.
37
+
#### `label` (string, optional) {#label}
38
+
39
+
Tooltip message displayed while hovering a mouse over the widget.
40
+
41
+
Default: `'Geocoder'`
25
42
26
43
#### `geocoder` (string, optional) {#geocoder}
27
44
28
45
Default: `'coordinates'`
29
46
30
47
Which geocoding service to use. Supported values are `'coordinates'`, `'google'`, `'mapbox'`, `'opencage'`, or `'custom'`.
31
48
32
-
#### `apiKey` (string, optional) {#apiKey}
49
+
#### `apiKey` (string, optional) {#apikey}
33
50
34
51
Required if `geocoder` is set to a third party provider. For quick testing, applications can use the `coordinates` geocode does not require an api key.
Only used when `geocoder` is `'custom'`. A function that receives the entered text and an API key, and resolves to a `{longitude, latitude}` object when successful.
In addition to addresses / coordinates, one position of obvious interest is the user's own current position. This experimental option adds a `current` menu item that calls the browser's geolocation API and navigates to the user's current position. Note that this requires the user to enable geolocation in the browser.
0 commit comments