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
better geoman instantiating, shape markers fix
  • Loading branch information
zxwild committed Oct 28, 2024
commit 298cd298daa3cb3dd9bd5f52232a8f54739f6c1e
15 changes: 11 additions & 4 deletions docs/01-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,16 @@ const gmOptions: GmOptionsPartial = {
// geoman options here
};

const geoman = new Geoman(gmOptions);
geoman.addControl(map).then(() => {
// geoman is available here as: "geoman" or "map.gm"
console.log('Geoman Controls added');
const geoman = new Geoman(map, gmOptions);

map.on('gm:loaded', () => {
console.log('Geoman fully loaded');

// Here you can add your geojson shapes for example
const shapeGeoJson = {
type: 'Feature',
geometry: { type: 'Point', coordinates: [0, 51] },
};
map.gm.features.addGeoJsonFeature({ shapeGeoJson });
});
```
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@docusaurus/core": "^3.5.2",
"@docusaurus/preset-classic": "^3.5.2",
"@geoman-io/maplibre-geoman-pro": "^0.0.17",
"@geoman-io/maplibre-geoman-pro": "^0.0.19",
"@mdx-js/react": "^3.0.0",
"maplibre-gl": "^4.5.2",
"lodash-es": "^4.17.21",
Expand Down
96 changes: 66 additions & 30 deletions src/components/examples/mode-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ export const drawMarkerOptions: PartialDeep<GmOptionsData> = {
controls: {
draw: {
marker: {
active: false,
active: true,
uiEnabled: true,
},
},
helper: {
snapping: {
uiEnabled: true,
active: true,
},
},
},
Expand All @@ -17,19 +23,31 @@ export const drawCircleMarkerOptions: PartialDeep<GmOptionsData> = {
controls: {
draw: {
circle_marker: {
active: false,
active: true,
uiEnabled: true,
},
},
helper: {
snapping: {
uiEnabled: true,
active: true,
},
},
},
};

export const drawTextMarkerOptions: PartialDeep<GmOptionsData> = {
controls: {
draw: {
text_marker: {
active: false,
active: true,
uiEnabled: true,
},
},
helper: {
snapping: {
uiEnabled: true,
active: true,
},
},
},
Expand All @@ -39,19 +57,31 @@ export const drawCircleOptions: PartialDeep<GmOptionsData> = {
controls: {
draw: {
circle: {
active: false,
active: true,
uiEnabled: true,
},
},
helper: {
snapping: {
uiEnabled: true,
active: true,
},
},
},
};

export const drawLineOptions: PartialDeep<GmOptionsData> = {
controls: {
draw: {
line: {
active: false,
active: true,
uiEnabled: true,
},
},
helper: {
snapping: {
uiEnabled: true,
active: true,
},
},
},
Expand All @@ -61,8 +91,14 @@ export const drawRectangleOptions: PartialDeep<GmOptionsData> = {
controls: {
draw: {
rectangle: {
active: false,
active: true,
uiEnabled: true,
},
},
helper: {
snapping: {
uiEnabled: true,
active: true,
},
},
},
Expand All @@ -72,14 +108,14 @@ export const drawPolygonOptions: PartialDeep<GmOptionsData> = {
controls: {
draw: {
polygon: {
active: false,
active: true,
uiEnabled: true,
},
},
helper: {
snapping: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -90,7 +126,7 @@ export const editDragOptions: PartialDeep<GmOptionsData> = {
edit: {
drag: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -101,7 +137,7 @@ export const editChangeOptions: PartialDeep<GmOptionsData> = {
edit: {
change: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -112,7 +148,7 @@ export const editRotateOptions: PartialDeep<GmOptionsData> = {
edit: {
rotate: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -123,7 +159,7 @@ export const editScaleOptions: PartialDeep<GmOptionsData> = {
edit: {
scale: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -134,7 +170,7 @@ export const editCopyOptions: PartialDeep<GmOptionsData> = {
edit: {
copy: {
uiEnabled: true,
active: false,
active: true,
},
drag: {
uiEnabled: true,
Expand All @@ -149,7 +185,7 @@ export const editCutOptions: PartialDeep<GmOptionsData> = {
edit: {
cut: {
uiEnabled: true,
active: false,
active: true,
},
drag: {
uiEnabled: true,
Expand All @@ -164,7 +200,7 @@ export const editSplitOptions: PartialDeep<GmOptionsData> = {
edit: {
split: {
uiEnabled: true,
active: false,
active: true,
},
drag: {
uiEnabled: true,
Expand All @@ -179,7 +215,7 @@ export const editUnionOptions: PartialDeep<GmOptionsData> = {
edit: {
union: {
uiEnabled: true,
active: false,
active: true,
},
drag: {
uiEnabled: true,
Expand All @@ -194,7 +230,7 @@ export const editDifferenceOptions: PartialDeep<GmOptionsData> = {
edit: {
difference: {
uiEnabled: true,
active: false,
active: true,
},
drag: {
uiEnabled: true,
Expand All @@ -209,7 +245,7 @@ export const editLineSimplificationOptions: PartialDeep<GmOptionsData> = {
edit: {
line_simplification: {
uiEnabled: true,
active: false,
active: true,
},
drag: {
uiEnabled: true,
Expand All @@ -224,7 +260,7 @@ export const editLassoOptions: PartialDeep<GmOptionsData> = {
edit: {
lasso: {
uiEnabled: true,
active: false,
active: true,
},
drag: {
uiEnabled: true,
Expand All @@ -239,7 +275,7 @@ export const editDeleteOptions: PartialDeep<GmOptionsData> = {
edit: {
delete: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -260,13 +296,13 @@ export const helperSnappingOptions: PartialDeep<GmOptionsData> = {
edit: {
change: {
uiEnabled: true,
active: false,
active: true,
},
},
helper: {
snapping: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -289,11 +325,11 @@ export const helperSnapGuidesOptions: PartialDeep<GmOptionsData> = {
helper: {
snap_guides: {
uiEnabled: true,
active: false,
active: true,
},
snapping: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -304,7 +340,7 @@ export const helperMeasurementsOptions: PartialDeep<GmOptionsData> = {
draw: {
marker: {
uiEnabled: true,
active: false,
active: true,
},
line: {
uiEnabled: true,
Expand All @@ -324,7 +360,7 @@ export const helperMeasurementsOptions: PartialDeep<GmOptionsData> = {
helper: {
measurements: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -351,11 +387,11 @@ export const helperPinOptions: PartialDeep<GmOptionsData> = {
helper: {
pin: {
uiEnabled: true,
active: false,
active: true,
},
snapping: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand All @@ -382,11 +418,11 @@ export const helperAutoTraceOptions: PartialDeep<GmOptionsData> = {
helper: {
auto_trace: {
uiEnabled: true,
active: false,
active: true,
},
snapping: {
uiEnabled: true,
active: false,
active: true,
},
},
},
Expand Down
6 changes: 2 additions & 4 deletions src/components/map/GmMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ const Component: React.FC<ComponentProps> = ({

const gmOptions = cloneDeep(defaultOptions);
merge(gmOptions, gmOptionsOverride);
const geoman = new Geoman(gmOptions);
map.gm = geoman;

geoman.addControl(map).then(() => {
console.log('Controls added');
const geoman = new Geoman(map, gmOptions);
map.on(`${gmOptions.settings?.eventPrefix || 'gm'}:loaded`, () => {
features?.forEach((feature) => {
geoman.features.addGeoJsonFeature({ shapeGeoJson: feature });
});
Expand Down
1 change: 0 additions & 1 deletion src/components/map/default-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const defaultOptions: PartialDeep<GmOptionsData> = {
settings: {
eventPrefix: 'pm',
throttlingDelay: 10,
debugEvents: false,
controlsPosition: 'top-left',
},
controls: {
Expand Down