Fix polygon edition
This commit is contained in:
parent
85e8a72148
commit
18327ebbf0
1 changed files with 8 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ BR.NogoAreas = L.Control.extend({
|
||||||
MSG_BUTTON_CANCEL: 'Cancel drawing no-go area',
|
MSG_BUTTON_CANCEL: 'Cancel drawing no-go area',
|
||||||
MSG_CREATE: 'Click and drag to draw circle',
|
MSG_CREATE: 'Click and drag to draw circle',
|
||||||
MSG_DISABLED: 'Click to edit',
|
MSG_DISABLED: 'Click to edit',
|
||||||
MSG_ENABLED: '□ = move / resize, <span class="fa fa-trash-o"></span> = delete,<br>click circle to quit editing',
|
MSG_ENABLED: '□ = move / resize, <span class="fa fa-trash-o"></span> = delete,<br>click nogo to quit editing',
|
||||||
STATE_CREATE: 'no-go-create',
|
STATE_CREATE: 'no-go-create',
|
||||||
STATE_CANCEL: 'cancel-no-go-create'
|
STATE_CANCEL: 'cancel-no-go-create'
|
||||||
},
|
},
|
||||||
|
|
@ -116,7 +116,9 @@ BR.NogoAreas = L.Control.extend({
|
||||||
return {
|
return {
|
||||||
nogos: this.drawnItems.getLayers().filter(function (e) { return e instanceof L.Circle; }),
|
nogos: this.drawnItems.getLayers().filter(function (e) { return e instanceof L.Circle; }),
|
||||||
polygons: this.drawnItems.getLayers().filter(function (e) { return e instanceof L.Polygon; }),
|
polygons: this.drawnItems.getLayers().filter(function (e) { return e instanceof L.Polygon; }),
|
||||||
polylines: this.drawnItems.getLayers().filter(function (e) { return e instanceof L.Polyline; }),
|
polylines: this.drawnItems.getLayers().filter(function (e) {
|
||||||
|
return (e instanceof L.Polyline) && !(e instanceof L.Polygon);
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -226,7 +228,10 @@ BR.EditingTooltip = L.Handler.extend({
|
||||||
// works better with zooming than updating offset to match radius
|
// works better with zooming than updating offset to match radius
|
||||||
layer.openTooltip = function (layer, latlng) {
|
layer.openTooltip = function (layer, latlng) {
|
||||||
if (!latlng && layer instanceof L.Layer) {
|
if (!latlng && layer instanceof L.Layer) {
|
||||||
latlng = L.latLng(layer.getBounds().getSouth(), layer.getLatLng().lng);
|
latlng = L.latLng(
|
||||||
|
layer.getBounds().getSouth(),
|
||||||
|
0.5 * (layer.getBounds().getWest() + layer.getBounds().getEast())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
L.Layer.prototype.openTooltip.call(this, layer, latlng);
|
L.Layer.prototype.openTooltip.call(this, layer, latlng);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue