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.
- package/CHANGELOG.md +20 -0
- package/dist/modes/base.mode.d.ts +7 -0
- package/dist/modes/render/render.mode.d.ts +2 -1
- package/dist/modes/select/select.mode.d.ts +11 -3
- package/dist/modes/static/static.mode.d.ts +2 -1
- package/dist/terra-draw.cjs +1 -1
- package/dist/terra-draw.cjs.map +1 -1
- package/dist/terra-draw.d.ts +1 -0
- package/dist/terra-draw.modern.js +1 -1
- package/dist/terra-draw.modern.js.map +1 -1
- package/dist/terra-draw.module.js +1 -1
- package/dist/terra-draw.module.js.map +1 -1
- package/dist/terra-draw.umd.js +1 -1
- package/dist/terra-draw.umd.js.map +1 -1
- package/guides/GETTING_STARTED.md +47 -7
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
256
|
+
To style selected data you will want to past styles to the select mode you are using (probably TerraDrawSelectMode).
|
|
247
257
|
|
|
248
|
-
|
|
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
|
-
|
|
289
|
+
draw.start();
|
|
290
|
+
```
|
|
251
291
|
|
|
252
|
-
|
|
292
|
+
Please note at the moment it is not possible to style against specific modes but only universally against geometry type (Point, LineString, Polygon)
|