Skip to content
Open
Changes from all commits
Commits
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
50 changes: 37 additions & 13 deletions leaflet-draw.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
*/
noStroke: {
type: Boolean,
value: false
value: false,
observer: "_updateStyle"
},

/**
Expand All @@ -128,7 +129,8 @@
*/
color: {
type: String,
value: "#03f"
value: "#03f",
observer: "_updateStyle"
},

/**
Expand All @@ -139,7 +141,8 @@
*/
weight: {
type: Number,
value: 5
value: 5,
observer: "_updateStyle"
},

/**
Expand All @@ -150,7 +153,8 @@
*/
opacity: {
type: Number,
value: 0.5
value: 0.5,
observer: "_updateStyle"
},

/**
Expand All @@ -161,7 +165,8 @@
*/
fill: {
type: Boolean,
value: null
value: null,
observer: "_updateStyle"
},

/**
Expand All @@ -172,7 +177,8 @@
*/
fillColor: {
type: String,
value: null
value: null,
observer: "_updateStyle"
},

/**
Expand All @@ -183,7 +189,8 @@
*/
fillOpacity: {
type: Number,
value: 0.2
value: 0.2,
observer: "_updateStyle"
},

/**
Expand All @@ -194,7 +201,8 @@
*/
dashArray: {
type: String,
value: null
value: null,
observer: "_updateStyle"
},

/**
Expand All @@ -205,7 +213,8 @@
*/
lineCap: {
type: String,
value: null
value: null,
observer: "_updateStyle"
},

/**
Expand All @@ -216,7 +225,8 @@
*/
lineJoin: {
type: String,
value: null
value: null,
observer: "_updateStyle"
},

/**
Expand All @@ -227,7 +237,8 @@
*/
noClickable: {
type: Boolean,
value: false
value: false,
observer: "_updateStyle"
},

/**
Expand All @@ -238,7 +249,8 @@
*/
pointerEvents: {
type: String,
value: null
value: null,
observer: "_updateStyle"
},

/**
Expand All @@ -249,7 +261,8 @@
*/
className: {
type: String,
value: ""
value: "",
observer: "_updateStyle"
}
},

Expand All @@ -269,6 +282,17 @@
pointerEvents: this.pointerEvents,
className: this.className,
};
},
/**
* If the item is already initialised (this.feature is set), it will update the style depending on the settings of this
* e.g. useful to change colors without deleting & re-inserting the item.
* @returns {*|result} result of this.feature.setStyle or undefined if no feature initialized
*/
_updateStyle: function() {
if (!this.feature) {
return;
}
return this.feature.setStyle(this.getPathOptions());
}
};

Expand Down