terra-draw 0.0.1-alpha.38 → 0.0.1-alpha.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -198,6 +198,18 @@ Coming soon - please see development folder for example for now.
198
198
 
199
199
  Coming soon - please see development folder for example for now.
200
200
 
201
+ ## Other Examples
202
+
203
+ There are a few other working examples that you can use as points of reference for creating a new app using Terra Draw.
204
+
205
+ ### Development Example
206
+
207
+ The [development folder features an example](https://github.com/JamesLMilner/terra-draw/tree/main/development) of using Terra Draw with all the adapters. It is meant for local development but can also be used as a guide of how to use Terra Draw with each adapter without any frame work.
208
+
209
+ ### Full Example
210
+
211
+ The [Terra Draw official website](https://github.com/JamesLMilner/terra-draw-website) is open source acts as a full working implementation of how to use Terra Draw. In this case it is used with popular framework Preact (has very similar API to React).
212
+
201
213
  ## Common Patterns
202
214
 
203
215
  ### Loading in External Data
@@ -239,14 +251,42 @@ draw.addFeatures(points);
239
251
  // This will add the points to hte TerraDrawRenderMode 'arbitary' rendering them to the screen
240
252
  ```
241
253
 
242
- ## Other Examples
243
-
244
- There are a few other working examples that you can use as points of reference for creating a new app using Terra Draw.
254
+ ### Styling Selected Data
245
255
 
246
- ### Development Example
256
+ To style selected data you will want to past styles to the select mode you are using (probably TerraDrawSelectMode).
247
257
 
248
- The [development folder features an example](https://github.com/JamesLMilner/terra-draw/tree/main/development) of using Terra Draw with all the adapters. It is meant for local development but can also be used as a guide of how to use Terra Draw with each adapter without any frame work.
258
+ ```typescript
259
+ const draw = new TerraDraw({
260
+ adapter: new TerraDrawMapboxGLAdapter({
261
+ map,
262
+ coordinatePrecision: 9,
263
+ }),
264
+ modes: {
265
+ polygon: new TerraDrawPolygonMode(),
266
+ select: new TerraDrawSelectMode({
267
+ flags: {
268
+ polygon: {
269
+ feature: {
270
+ draggable: true,
271
+ coordinates: {
272
+ midpoints: true,
273
+ draggable: true,
274
+ deletable: true,
275
+ },
276
+ },
277
+ },
278
+ },
279
+ styles: {
280
+ selectedPolygonColor: "#222222", // Any hex color you like
281
+ selectedPolygonFillOpacity: 0.7, // 0 - 1
282
+ selectedPolygonOutlineColor: "#333333", // Any hex color you like
283
+ selectedPolygonOutlineWidth: 2, // Integer
284
+ },
285
+ }),
286
+ },
287
+ });
249
288
 
250
- ### Full Example
289
+ draw.start();
290
+ ```
251
291
 
252
- The [Terra Draw official website](https://github.com/JamesLMilner/terra-draw-website) is open source acts as a full working implementation of how to use Terra Draw. In this case it is used with popular framework Preact (has very similar API to React).
292
+ Please note at the moment it is not possible to style against specific modes but only universally against geometry type (Point, LineString, Polygon)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terra-draw",
3
- "version": "0.0.1-alpha.38",
3
+ "version": "0.0.1-alpha.40",
4
4
  "description": "Frictionless map drawing across mapping provider",
5
5
  "scripts": {
6
6
  "docs": "typedoc",