Skip to content

Commit 5d080b9

Browse files
committed
draw plugin: added more clones of given models to avoid conflits with read-only objects
1 parent 882a23c commit 5d080b9

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

.yarn/install-state.gz

-197 Bytes
Binary file not shown.

dev/drawData.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import type { DrawModel } from '@/plugins/draw';
22

3-
export const drawCircleExample: DrawModel = {
4-
"type": "Feature",
5-
"properties": {
6-
"center": [
3+
export const drawCircleExample: DrawModel = Object.freeze({
4+
'type' : 'Feature',
5+
'properties': {
6+
'center' : [
77
10.010300035650772,
88
53.55286295947664
99
],
10-
"radius": 26158.912849222437,
11-
"meta": "circle",
12-
"minSizeLabel": "TOO SMALL",
13-
"area": 2149756420.251772,
14-
"tooSmall": false
10+
'radius' : 26158.912849222437,
11+
'meta' : 'circle',
12+
'minSizeLabel': 'TOO SMALL',
13+
'area' : 2149756420.251772,
14+
'tooSmall' : false
1515
},
16-
"geometry": {
17-
"type": "Polygon",
18-
"coordinates": [
16+
'geometry' : {
17+
'type' : 'Polygon',
18+
'coordinates': [
1919
[
2020
[
2121
10.010300035650772,
@@ -280,24 +280,24 @@ export const drawCircleExample: DrawModel = {
280280
]
281281
]
282282
}
283-
};
283+
});
284284

285-
export const drawCircleExample2: DrawModel = {
286-
"type": "Feature",
287-
"properties": {
288-
"center": [
285+
export const drawCircleExample2: DrawModel = Object.freeze({
286+
'type' : 'Feature',
287+
'properties': {
288+
'center' : [
289289
8.54997026487834,
290290
53.5689240486912
291291
],
292-
"radius": 26158.912849222437,
293-
"meta": "circle",
294-
"minSizeLabel": "TOO SMALL",
295-
"area": 2149756420.251772,
296-
"tooSmall": false
292+
'radius' : 26158.912849222437,
293+
'meta' : 'circle',
294+
'minSizeLabel': 'TOO SMALL',
295+
'area' : 2149756420.251772,
296+
'tooSmall' : false
297297
},
298-
"geometry": {
299-
"type": "Polygon",
300-
"coordinates": [
298+
'geometry' : {
299+
'type' : 'Polygon',
300+
'coordinates': [
301301
[
302302
[
303303
8.54997026487834,
@@ -562,9 +562,9 @@ export const drawCircleExample2: DrawModel = {
562562
]
563563
]
564564
}
565-
};
565+
});
566566

567-
export const drawPolygonExample: DrawModel = {
567+
export const drawPolygonExample: DrawModel = Object.freeze({
568568
'type' : 'Feature',
569569
'properties': {
570570
'meta': 'polygon'
@@ -672,4 +672,4 @@ export const drawPolygonExample: DrawModel = {
672672
]
673673
]
674674
}
675-
};
675+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-maplibre-gl",
3-
"version": "5.5.1",
3+
"version": "5.5.2",
44
"description": "Vue 3 plugin for maplibre-gl",
55
"keywords": [
66
"vue",

src/plugins/draw/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class DrawPlugin {
5454
}
5555

5656
setMode(value: DrawMode, model?: DrawModel) {
57-
this._model = model;
57+
this._model = model ? clone(model) : undefined;
5858
if (this._mode !== value) {
5959
this._mode = value;
6060
this.setupMode();

0 commit comments

Comments
 (0)