Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
190d187
Update docusaurus.config.ts
mscno Aug 21, 2024
747011b
deps
mscno Aug 21, 2024
2f7bc3f
add leaflet docs link
mscno Aug 21, 2024
3c9a729
build first version of map libre docs
mscno Sep 18, 2024
0b80cfb
path fix
mscno Sep 18, 2024
55851ea
change header
mscno Sep 18, 2024
2e7f278
fix links
mscno Sep 18, 2024
b7e36a5
tweaks
mscno Sep 18, 2024
8af384a
fix links
mscno Sep 18, 2024
3066293
fix url
mscno Sep 18, 2024
c110cc3
tests
mscno Sep 18, 2024
923a24c
tmp remove all docs
mscno Sep 18, 2024
c6ba871
tweak maplibre
mscno Sep 23, 2024
9490ac7
tweak vercel
mscno Sep 23, 2024
93f56dc
test new baseurkl
mscno Sep 23, 2024
f595c30
test again
mscno Sep 23, 2024
3bd9fd9
fix vercel maplibre
mscno Sep 23, 2024
e361619
update vercel with root redir
mscno Sep 23, 2024
bf5838c
fix path
mscno Sep 23, 2024
c6b8d87
dummy files for all draw/edit/helper modes
zxwild Oct 23, 2024
cd3d4ac
basic demo map for each mode
zxwild Oct 23, 2024
ab970ef
update geoman maplibre version, typing fixes
zxwild Oct 23, 2024
3c27eb4
geojson features, required modes for demo maps
zxwild Oct 24, 2024
aeb14aa
basic documentation for edit modes
zxwild Oct 24, 2024
e4b6931
basic docs for draw modes
zxwild Oct 25, 2024
4f67e87
basic docs for helper modes
zxwild Oct 25, 2024
8b4bedd
basic operations docs: init, events, modes
zxwild Oct 25, 2024
38b810e
typo fixes
zxwild Oct 25, 2024
26b0f8f
events doc fix
zxwild Oct 25, 2024
298cd29
better geoman instantiating, shape markers fix
zxwild Oct 28, 2024
01dd062
more docs for mode handling methods
zxwild Oct 30, 2024
4f94cfa
fix auto enabled states for modes with actions
zxwild Oct 30, 2024
389e9b6
Update 01-basics.md
dailyprice Nov 10, 2024
cf157d8
Merge pull request #1 from geoman-io/doc_updates
mscno Nov 13, 2024
be11a4c
fix unquoted html tags
mscno Nov 13, 2024
7f16a6e
try fix clean urls
mscno Nov 13, 2024
206ec2c
Update index.md
dailyprice Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
basic documentation for edit modes
  • Loading branch information
zxwild committed Oct 24, 2024
commit aeb14aadb8f4af9e574850a875d9d36f8244bf29
2 changes: 1 addition & 1 deletion docs/draw-modes/00-draw-marker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ You can enable Marker Mode on your map to allow users to draw marker geometries.

## Live Marker Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { drawMarkerOptions } from '../../src/components/examles/mode-options';
import { drawMarkerOptions } from '../../src/components/examples/mode-options';

<BrowserOnlyGmMap gmOptions={drawMarkerOptions} />
2 changes: 1 addition & 1 deletion docs/draw-modes/01-draw-circle_marker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ You can enable Circle Marker Mode on your map to allow users to draw circle mark

## Live Circle Marker Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { drawCircleMarkerOptions } from '../../src/components/examles/mode-options';
import { drawCircleMarkerOptions } from '../../src/components/examples/mode-options';

<BrowserOnlyGmMap gmOptions={drawCircleMarkerOptions} />
2 changes: 1 addition & 1 deletion docs/draw-modes/02-draw-text_marker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ You can enable Text Marker Mode on your map to allow users to draw text marker g

## Live Text Marker Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { drawTextMarkerOptions } from '../../src/components/examles/mode-options';
import { drawTextMarkerOptions } from '../../src/components/examples/mode-options';

<BrowserOnlyGmMap gmOptions={drawTextMarkerOptions} />
2 changes: 1 addition & 1 deletion docs/draw-modes/03-draw-circle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ You can enable Circle Mode on your map to allow users to draw circle geometries.

## Live Circle Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { drawCircleOptions } from '../../src/components/examles/mode-options';
import { drawCircleOptions } from '../../src/components/examples/mode-options';

<BrowserOnlyGmMap gmOptions={drawCircleOptions} />
2 changes: 1 addition & 1 deletion docs/draw-modes/04-draw-line.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ You can enable Line Mode on your map to allow users to draw line geometries.

## Live Line Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { drawLineOptions } from '../../src/components/examles/mode-options';
import { drawLineOptions } from '../../src/components/examples/mode-options';

<BrowserOnlyGmMap gmOptions={drawLineOptions} />
2 changes: 1 addition & 1 deletion docs/draw-modes/05-draw-rectangle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ You can enable Rectangle Mode on your map to allow users to draw rectangle geome

## Live Rectangle Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { drawRectangleOptions } from '../../src/components/examles/mode-options';
import { drawRectangleOptions } from '../../src/components/examples/mode-options';

<BrowserOnlyGmMap gmOptions={drawRectangleOptions} />
2 changes: 1 addition & 1 deletion docs/draw-modes/06-draw-polygon.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ You can enable Polygon Mode on your map to allow users to draw polygon geometrie

## Live Polygon Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { drawPolygonOptions } from '../../src/components/examles/mode-options';
import { drawPolygonOptions } from '../../src/components/examples/mode-options';

<BrowserOnlyGmMap gmOptions={drawPolygonOptions} />
46 changes: 42 additions & 4 deletions docs/edit-modes/00-edit-drag.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,52 @@ title: "Drag"

## Drag Mode

You can enable Drag Mode on your map to allow users to drag geometries.
You can enable Drag Mode for all layers on a map like this:

<!-- Add detailed documentation and code examples for Drag Mode here -->
```js
// Enable Drag Mode like this:
map.gm.enableGlobalDragMode();

// Or like this:
map.gm.options.enableMode('edit', 'drag');
```


The following methods are available on `map.gm`:

| Method | Returns | Description |
|:------------------------------------------------------------------| :-------- | :-----------------------------|
| `enableGlobalDragMode()` | - | Enables global Drag Mode. |
| `disableGlobalDragMode()` | - | Disables global Drag Mode. |
| `toggleGlobalDragMode()` | - | Toggles global Drag Mode. |
| `globalDragModeEnabled()` | `Boolean` | Returns `true` if global Drag Mode is enabled. `false` when disabled. |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :------------- | :----- | :------------------------------------------- | :-------------------------|
| `gm:dragstart` | `event`| Fired when a layer starts being dragged. | `map`, `feature`, `shape` |
| `gm:drag` | `event`| Fired when a layer is dragged. | `map`, `feature`, `shape` |
| `gm:dragend` | `event`| Fired when a layer stops being dragged. | `map`, `feature`, `shape` |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :----------------------- | :----- | :------------------------------- | :--------------------- |
| `gm:globaldragmodetoggled` | `event` | Fired when Drag Mode is toggled. | `enabled`, `map` |

You can also listen to specific Drag Mode events on the map instance like this:

```js
map.on('gm:globaldragmodetoggled', (event) => {
console.log(event);
});
```

## Live Drag Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { editDragOptions } from '../../src/components/examles/mode-options';
import features from '../../src/components/examles/geojson/basic-edit.json';
import { editDragOptions } from '../../src/components/examples/mode-options';
import features from '../../src/components/examples/geojson/basic-edit.json';

<BrowserOnlyGmMap
gmOptions={editDragOptions}
Expand Down
52 changes: 44 additions & 8 deletions docs/edit-modes/01-edit-change.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
---
title: "Change"
title: "Edit"
---

## Change Mode
## Edit Mode

You can enable Change Mode on your map to allow users to change geometries.
You can enable Edit Mode for all layers on a map like this:

<!-- Add detailed documentation and code examples for Change Mode here -->
```js
// Enable Edit Mode like this:
map.gm.enableGlobalEditMode();

## Live Change Example
// Or like this:
map.gm.options.enableMode('edit', 'change');
```

The following methods are available on `map.gm`:

| Method | Returns | Description |
|:------------------------------------------------------------------| :-------- | :-----------------------------|
| `enableGlobalEditMode()` | - | Enables global Edit Mode. |
| `disableGlobalEditMode()` | - | Disables global Edit Mode. |
| `toggleGlobalEditMode()` | - | Toggles global Edit Mode. |
| `globalEditModeEnabled()` | `Boolean` | Returns `true` if global Edit Mode is enabled. `false` when disabled. |

The following events are available on a map instance:

| Event | Params | Description | Output |
|:-------------------------| :----- | :------------------------------------------- | :-------------------------|
| `gm:editstart` | `event`| Fired when a layer starts being changed. | `map`, `feature`, `shape` |
| `gm:edit` | `event`| Fired when a layer is being changed. | `map`, `feature`, `shape` |
| `gm:editend` | `event`| Fired when a layer stops being changed. | `map`, `feature`, `shape` |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :------------------------- | :------ | :--------------------------------- | :--------------------- |
| `gm:globaleditmodetoggled` | `event` | Fired when Edit Mode is toggled. | `enabled`, `map` |

You can also listen to specific Edit Mode events on the map instance like this:

```js
map.on('gm:globaleditmodetoggled', (event) => {
console.log(event);
});
```

## Live Edit Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { editChangeOptions } from '../../src/components/examles/mode-options';
import features from '../../src/components/examles/geojson/basic-edit.json';
import { editChangeOptions } from '../../src/components/examples/mode-options';
import features from '../../src/components/examples/geojson/basic-edit.json';

<BrowserOnlyGmMap
gmOptions={editChangeOptions}
features={features} />

45 changes: 41 additions & 4 deletions docs/edit-modes/02-edit-rotate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,51 @@ title: "Rotate"

## Rotate Mode

You can enable Rotate Mode on your map to allow users to rotate geometries.
You can enable Rotate Mode for all layers on a map like this:

<!-- Add detailed documentation and code examples for Rotate Mode here -->
```js
// Enable Rotate Mode like this:
map.gm.enableGlobalRotateMode();

// Or like this:
map.gm.options.enableMode('edit', 'rotate');
```

The following methods are available on `map.gm`:

| Method | Returns | Description |
|:------------------------------------------------------------------| :-------- | :-----------------------------|
| `enableGlobalRotateMode()` | - | Enables global Rotate Mode. |
| `disableGlobalRotateMode()` | - | Disables global Rotate Mode. |
| `toggleGlobalRotateMode()` | - | Toggles global Rotate Mode. |
| `globalRotateModeEnabled()` | `Boolean` | Returns `true` if global Rotate Mode is enabled. `false` when disabled. |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :--------------- | :----- | :------------------------------------------- | :-------------------------|
| `gm:rotatestart` | `event`| Fired when a layer starts being rotated. | `map`, `feature`, `shape` |
| `gm:rotate` | `event`| Fired when a layer is being rotated. | `map`, `feature`, `shape` |
| `gm:rotateend` | `event`| Fired when a layer stops being rotated. | `map`, `feature`, `shape` |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :------------------------- | :------ | :--------------------------------- | :--------------------- |
| `gm:globalrotatemodetoggled` | `event` | Fired when Rotate Mode is toggled. | `enabled`, `map` |

You can also listen to specific Rotate Mode events on the map instance like this:

```js
map.on('gm:globalrotatemodetoggled', (event) => {
console.log(event);
});
```

## Live Rotate Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { editRotateOptions } from '../../src/components/examles/mode-options';
import features from '../../src/components/examles/geojson/basic-edit.json';
import { editRotateOptions } from '../../src/components/examples/mode-options';
import features from '../../src/components/examples/geojson/basic-edit.json';

<BrowserOnlyGmMap
gmOptions={editRotateOptions}
Expand Down
55 changes: 51 additions & 4 deletions docs/edit-modes/03-edit-scale.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,61 @@ title: "Scale"

## Scale Mode

You can enable Scale Mode on your map to allow users to scale geometries.
You can enable Scale Mode for all layers on a map like this:

<!-- Add detailed documentation and code examples for Scale Mode here -->
```js
// Enable Scale Mode like this:
map.gm.enableGlobalScaleMode();

// Or like this:
map.gm.options.enableMode('edit', 'scale');
```

The following methods are available on `map.gm`:

| Method | Returns | Description |
|:------------------------------------------------------------------| :-------- | :-----------------------------|
| `enableGlobalScaleMode()` | - | Enables global Scale Mode. |
| `disableGlobalScaleMode()` | - | Disables global Scale Mode. |
| `toggleGlobalScaleMode()` | - | Toggles global Scale Mode. |
| `globalScaleModeEnabled()` | `Boolean` | Returns `true` if global Scale Mode is enabled. `false` when disabled. |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :--------------- | :----- | :------------------------------------------- | :-------------------------|
| `gm:scalestart` | `event`| Fired when a layer starts being scaled. | `map`, `feature`, `shape` |
| `gm:scale` | `event`| Fired when a layer is being scaled. | `map`, `feature`, `shape` |
| `gm:scaleend` | `event`| Fired when a layer stops being scaled. | `map`, `feature`, `shape` |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :------------------------- | :------ | :--------------------------------- | :--------------------- |
| `gm:globalscalemodetoggled` | `event` | Fired when Scale Mode is toggled. | `enabled`, `map` |

You can also listen to specific Scale Mode events on the map instance like this:

```js
map.on('gm:globalscalemodetoggled', (event) => {
console.log(event);
});
```

## Supported Features

Scale mode supports the following feature types:
- Polygons
- Rectangles
- Lines
- Circles

When scaling, the feature will maintain its proportions relative to its centroid point. For rectangles, the scaling operation preserves the rectangular shape while adjusting its size.

## Live Scale Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { editScaleOptions } from '../../src/components/examles/mode-options';
import features from '../../src/components/examles/geojson/basic-edit.json';
import { editScaleOptions } from '../../src/components/examples/mode-options';
import features from '../../src/components/examples/geojson/basic-edit.json';

<BrowserOnlyGmMap
gmOptions={editScaleOptions}
Expand Down
52 changes: 48 additions & 4 deletions docs/edit-modes/04-edit-copy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,58 @@ title: "Copy"

## Copy Mode

You can enable Copy Mode on your map to allow users to copy geometries.
You can enable Copy Mode for all layers on a map like this:

<!-- Add detailed documentation and code examples for Copy Mode here -->
```js
// Enable Copy Mode like this:
map.gm.enableGlobalCopyMode();

// Or like this:
map.gm.options.enableMode('edit', 'copy');
```

The following methods are available on `map.gm`:

| Method | Returns | Description |
|:------------------------------------------------------------------| :-------- | :-----------------------------|
| `enableGlobalCopyMode()` | - | Enables global Copy Mode. |
| `disableGlobalCopyMode()` | - | Disables global Copy Mode. |
| `toggleGlobalCopyMode()` | - | Toggles global Copy Mode. |
| `globalCopyModeEnabled()` | `Boolean` | Returns `true` if global Copy Mode is enabled. `false` when disabled. |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :------------- | :----- | :------------------------------------------- | :-------------------------|
| `gm:copystart` | `event`| Fired when a layer starts being copied. | `map`, `feature`, `shape` |
| `gm:copy` | `event`| Fired when a layer is being copied. | `map`, `feature`, `shape` |
| `gm:copyend` | `event`| Fired when a layer is copied. | `map`, `feature`, `shape` |

The following events are available on a map instance:

| Event | Params | Description | Output |
| :------------------------- | :------ | :--------------------------------- | :--------------------- |
| `gm:globalcopymodetoggled` | `event` | Fired when Copy Mode is toggled. | `enabled`, `map` |

You can also listen to specific Copy Mode events on the map instance like this:

```js
map.on('gm:globalcopymodetoggled', (event) => {
console.log(event);
});
```

## Behavior

Copy mode operates in two ways:

1. **Sticky Mode Enabled**: A shape can be selected once and then copied multiple times on each subsequent click.
2. **Sticky Mode Disabled**: A shape is copied when a user drags it to a new location.

## Live Copy Example
import BrowserOnlyGmMap from '../../src/components/map/BrowserOnlyGmMap';
import { editCopyOptions } from '../../src/components/examles/mode-options';
import features from '../../src/components/examles/geojson/basic-edit.json';
import { editCopyOptions } from '../../src/components/examples/mode-options';
import features from '../../src/components/examples/geojson/basic-edit.json';

<BrowserOnlyGmMap
gmOptions={editCopyOptions}
Expand Down
Loading