diff options
Diffstat (limited to 'snippets')
| -rw-r--r-- | snippets/html_leaflet | 9 | ||||
| -rw-r--r-- | snippets/html_maplibre_cdn | 1 | ||||
| -rw-r--r-- | snippets/javascript_promise | 3 | ||||
| -rw-r--r-- | snippets/javascript_terrdraw | 32 |
4 files changed, 45 insertions, 0 deletions
diff --git a/snippets/html_leaflet b/snippets/html_leaflet new file mode 100644 index 0000000..7b434c1 --- /dev/null +++ b/snippets/html_leaflet | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" | ||
| 2 | integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" | ||
| 3 | crossorigin=""/> | ||
| 4 | <!-- Make sure you put this AFTER Leaflet's CSS --> | ||
| 5 | <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" | ||
| 6 | integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" | ||
| 7 | crossorigin=""></script> | ||
| 8 | |||
| 9 | |||
diff --git a/snippets/html_maplibre_cdn b/snippets/html_maplibre_cdn new file mode 100644 index 0000000..4dc2b17 --- /dev/null +++ b/snippets/html_maplibre_cdn | |||
| @@ -0,0 +1 @@ | |||
| <script src='https://unpkg.com/maplibre-gl@4.6.0/dist/maplibre-gl.js'></script> | |||
diff --git a/snippets/javascript_promise b/snippets/javascript_promise new file mode 100644 index 0000000..12128a7 --- /dev/null +++ b/snippets/javascript_promise | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | new Promise((resolve, reject) => { | ||
| 2 | |||
| 3 | }) | ||
diff --git a/snippets/javascript_terrdraw b/snippets/javascript_terrdraw new file mode 100644 index 0000000..17363b1 --- /dev/null +++ b/snippets/javascript_terrdraw | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | // Events | ||
| 2 | draw.on("finish", (id: string, context: { action: string, mode: string }) => { | ||
| 3 | if (action === 'draw') { | ||
| 4 | // Do something for draw finish event | ||
| 5 | } else if (action === 'dragFeature') { | ||
| 6 | // Do something for a drag finish event | ||
| 7 | } else if (action === 'dragCoordinate') { | ||
| 8 | // | ||
| 9 | }else if (action === 'dragCoordinateResize') { | ||
| 10 | // | ||
| 11 | } | ||
| 12 | }); | ||
| 13 | |||
| 14 | draw.on("change", (ids: string[], type: string) => { | ||
| 15 | // Possible type values: | ||
| 16 | // 'create' | ||
| 17 | // 'update' | ||
| 18 | // 'delete' | ||
| 19 | // 'styling' | ||
| 20 | // Do something | ||
| 21 | //... | ||
| 22 | }); | ||
| 23 | |||
| 24 | draw.on("select", (id: string) => { | ||
| 25 | // Do something | ||
| 26 | //... | ||
| 27 | }); | ||
| 28 | |||
| 29 | draw.on("deselect", () => { | ||
| 30 | // Do something | ||
| 31 | //... | ||
| 32 | }); | ||