maplibre-gl-geo-editor 0.10.3 → 0.10.4
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/dist/{geo-editor-CRh9g4mD.cjs → geo-editor-C6-E5RN2.cjs} +25 -15
- package/dist/geo-editor-C6-E5RN2.cjs.map +1 -0
- package/dist/{geo-editor-CCU2yWKB.js → geo-editor-RiqEfzJp.js} +25 -15
- package/dist/geo-editor-RiqEfzJp.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +2 -2
- package/dist/types/index.d.ts +6 -1
- package/dist/types/react.d.ts +12 -2
- package/package.json +1 -1
- package/dist/geo-editor-CCU2yWKB.js.map +0 -1
- package/dist/geo-editor-CRh9g4mD.cjs.map +0 -1
|
@@ -16624,6 +16624,8 @@ const DEFAULT_OPTIONS = {
|
|
|
16624
16624
|
topologyEnabled: false,
|
|
16625
16625
|
measurementsEnabled: false,
|
|
16626
16626
|
hideGeomanControl: true,
|
|
16627
|
+
massingHeightProperty: "height",
|
|
16628
|
+
massingDefaultHeight: 10,
|
|
16627
16629
|
saveFilename: "features.geojson",
|
|
16628
16630
|
onFeatureCreate: () => {
|
|
16629
16631
|
},
|
|
@@ -19490,7 +19492,7 @@ class GeoEditor {
|
|
|
19490
19492
|
if (mode === "freehand") {
|
|
19491
19493
|
this.enableFreehandMode();
|
|
19492
19494
|
} else if (this.geoman) {
|
|
19493
|
-
this.geoman.enableDraw(mode);
|
|
19495
|
+
this.geoman.enableDraw(mode === "massing" ? "polygon" : mode);
|
|
19494
19496
|
setTimeout(() => this.applyVertexMarkerStyles(), 50);
|
|
19495
19497
|
}
|
|
19496
19498
|
};
|
|
@@ -19656,7 +19658,7 @@ class GeoEditor {
|
|
|
19656
19658
|
setupDrawFinishHandlers() {
|
|
19657
19659
|
if (!this.map) return;
|
|
19658
19660
|
const handler = (e) => {
|
|
19659
|
-
if (this.state.activeDrawMode !== "polygon" && this.state.activeDrawMode !== "line") {
|
|
19661
|
+
if (this.state.activeDrawMode !== "polygon" && this.state.activeDrawMode !== "massing" && this.state.activeDrawMode !== "line") {
|
|
19660
19662
|
return;
|
|
19661
19663
|
}
|
|
19662
19664
|
if (this.finishActiveLineOrPolygonDraw()) {
|
|
@@ -19695,7 +19697,7 @@ class GeoEditor {
|
|
|
19695
19697
|
* @returns true when a shape was finished, false otherwise.
|
|
19696
19698
|
*/
|
|
19697
19699
|
finishActiveLineOrPolygonDraw() {
|
|
19698
|
-
const mode = this.state.activeDrawMode;
|
|
19700
|
+
const mode = this.state.activeDrawMode === "massing" ? "polygon" : this.state.activeDrawMode;
|
|
19699
19701
|
if (mode !== "polygon" && mode !== "line") return false;
|
|
19700
19702
|
if (!this.geoman) return false;
|
|
19701
19703
|
try {
|
|
@@ -20525,6 +20527,10 @@ class GeoEditor {
|
|
|
20525
20527
|
* Update Geoman feature properties
|
|
20526
20528
|
*/
|
|
20527
20529
|
updateFeatureProperties(geomanData, properties) {
|
|
20530
|
+
if (geomanData.updateProperties) {
|
|
20531
|
+
geomanData.updateProperties(properties ?? {});
|
|
20532
|
+
return;
|
|
20533
|
+
}
|
|
20528
20534
|
const geoJson = geomanData.getGeoJson ? geomanData.getGeoJson() : geomanData.geoJson;
|
|
20529
20535
|
if (geoJson) {
|
|
20530
20536
|
geoJson.properties = properties;
|
|
@@ -21556,6 +21562,7 @@ class GeoEditor {
|
|
|
21556
21562
|
line: "Line",
|
|
21557
21563
|
rectangle: "Rectangle",
|
|
21558
21564
|
polygon: "Polygon",
|
|
21565
|
+
massing: "Building massing",
|
|
21559
21566
|
freehand: "Freehand",
|
|
21560
21567
|
// Edit modes
|
|
21561
21568
|
select: "Select (click features)",
|
|
@@ -21580,6 +21587,7 @@ class GeoEditor {
|
|
|
21580
21587
|
getModeIcon(mode) {
|
|
21581
21588
|
const icons = {
|
|
21582
21589
|
polygon: '<svg viewBox="0 0 24 24" width="18" height="18"><polygon points="12,2 22,8 18,22 6,22 2,8" fill="none" stroke="currentColor" stroke-width="2"/></svg>',
|
|
21590
|
+
massing: '<svg viewBox="0 0 24 24" width="18" height="18"><path d="M4 8l8-4 8 4-8 4-8-4zm0 0v8l8 4 8-4V8M12 12v8" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/></svg>',
|
|
21583
21591
|
line: '<svg viewBox="0 0 24 24" width="18" height="18"><line x1="4" y1="20" x2="20" y2="4" stroke="currentColor" stroke-width="2"/></svg>',
|
|
21584
21592
|
rectangle: '<svg viewBox="0 0 24 24" width="18" height="18"><rect x="3" y="5" width="18" height="14" fill="none" stroke="currentColor" stroke-width="2"/></svg>',
|
|
21585
21593
|
circle: '<svg viewBox="0 0 24 24" width="18" height="18"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="2"/></svg>',
|
|
@@ -21600,7 +21608,7 @@ class GeoEditor {
|
|
|
21600
21608
|
freehand: '<svg viewBox="0 0 24 24" width="18" height="18"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z" fill="none" stroke="currentColor" stroke-width="2"/></svg>',
|
|
21601
21609
|
circle_marker: '<svg viewBox="0 0 24 24" width="18" height="18"><circle cx="12" cy="12" r="4" fill="currentColor"/></svg>',
|
|
21602
21610
|
ellipse: '<svg viewBox="0 0 24 24" width="18" height="18"><ellipse cx="12" cy="12" rx="10" ry="6" fill="none" stroke="currentColor" stroke-width="2"/></svg>',
|
|
21603
|
-
text_marker: '<svg viewBox="0 0 24 24" width="18" height="18"><text x="12" y="
|
|
21611
|
+
text_marker: '<svg viewBox="0 0 24 24" width="18" height="18"><text x="12" y="20" text-anchor="middle" font-size="20" fill="currentColor">T</text></svg>'
|
|
21604
21612
|
};
|
|
21605
21613
|
return icons[mode] || `<span>${mode[0].toUpperCase()}</span>`;
|
|
21606
21614
|
}
|
|
@@ -21705,11 +21713,7 @@ class GeoEditor {
|
|
|
21705
21713
|
const candidateId = this.getGeomanIdFromFeature(candidate);
|
|
21706
21714
|
return !(editedId && candidateId === editedId);
|
|
21707
21715
|
});
|
|
21708
|
-
const changed = propagateSharedVertexMoves(
|
|
21709
|
-
oldFeature,
|
|
21710
|
-
newFeature,
|
|
21711
|
-
targets
|
|
21712
|
-
);
|
|
21716
|
+
const changed = propagateSharedVertexMoves(oldFeature, newFeature, targets);
|
|
21713
21717
|
this.applyingTopology = true;
|
|
21714
21718
|
const edits = [];
|
|
21715
21719
|
try {
|
|
@@ -21739,6 +21743,16 @@ class GeoEditor {
|
|
|
21739
21743
|
);
|
|
21740
21744
|
const eventAction = event.action ?? "";
|
|
21741
21745
|
if ((eventName === "gm:create" || event.type === "gm:create") && eventFeature) {
|
|
21746
|
+
if (this.state.activeDrawMode === "massing" && (eventFeature.geometry.type === "Polygon" || eventFeature.geometry.type === "MultiPolygon")) {
|
|
21747
|
+
eventFeature.properties = {
|
|
21748
|
+
...eventFeature.properties,
|
|
21749
|
+
[this.options.massingHeightProperty]: this.options.massingDefaultHeight
|
|
21750
|
+
};
|
|
21751
|
+
const geomanData = this.findGeomanDataForFeature(eventFeature);
|
|
21752
|
+
if (geomanData) {
|
|
21753
|
+
this.updateFeatureProperties(geomanData, eventFeature.properties);
|
|
21754
|
+
}
|
|
21755
|
+
}
|
|
21742
21756
|
const createdFeature = this.applyTopologyToCreatedFeature(eventFeature);
|
|
21743
21757
|
if (!createdFeature) return;
|
|
21744
21758
|
this.lastCreatedFeature = createdFeature;
|
|
@@ -21902,11 +21916,7 @@ class GeoEditor {
|
|
|
21902
21916
|
const commands = [
|
|
21903
21917
|
new EditFeatureCommand(oldFeature, newFeature, context),
|
|
21904
21918
|
...propagatedEdits.map(
|
|
21905
|
-
(edit) => new EditFeatureCommand(
|
|
21906
|
-
edit.oldFeature,
|
|
21907
|
-
edit.newFeature,
|
|
21908
|
-
context
|
|
21909
|
-
)
|
|
21919
|
+
(edit) => new EditFeatureCommand(edit.oldFeature, edit.newFeature, context)
|
|
21910
21920
|
)
|
|
21911
21921
|
];
|
|
21912
21922
|
this.historyManager.record(
|
|
@@ -22336,4 +22346,4 @@ exports.safeUnion = safeUnion;
|
|
|
22336
22346
|
exports.selectFeaturesWithinLasso = selectFeaturesWithinLasso;
|
|
22337
22347
|
exports.toSelectedFeatures = toSelectedFeatures;
|
|
22338
22348
|
exports.toggleInSelection = toggleInSelection;
|
|
22339
|
-
//# sourceMappingURL=geo-editor-
|
|
22349
|
+
//# sourceMappingURL=geo-editor-C6-E5RN2.cjs.map
|