mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Fix duplicate measure behavior on editable maps.
This commit is contained in:
parent
3984b8d8dd
commit
6d8d070198
|
@ -15,20 +15,21 @@
|
||||||
opts.wkt = wkt;
|
opts.wkt = wkt;
|
||||||
}
|
}
|
||||||
var layer = instance.addLayer(type, opts);
|
var layer = instance.addLayer(type, opts);
|
||||||
instance.addBehavior('measure', { layer: layer });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If edit is true, enable drawing controls.
|
// If edit is true, enable drawing controls.
|
||||||
if (Drupal.settings.farm_map.behaviors.wkt.edit) {
|
if (Drupal.settings.farm_map.behaviors.wkt.edit) {
|
||||||
if (layer !== undefined) {
|
if (layer !== undefined) {
|
||||||
instance.addBehavior('edit', { layer: layer });
|
instance.addBehavior('edit', { layer: layer });
|
||||||
instance.addBehavior('measure', { layer: layer });
|
|
||||||
} else {
|
} else {
|
||||||
instance.addBehavior('edit');
|
instance.addBehavior('edit');
|
||||||
instance.addBehavior('measure', { layer: instance.edit.layer });
|
var layer = instance.edit.layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable the line/polygon measure behavior.
|
||||||
|
instance.addBehavior('measure', { layer: layer });
|
||||||
|
|
||||||
// If zoom is true and the layer has features, zoom to them.
|
// If zoom is true and the layer has features, zoom to them.
|
||||||
// Otherwise, zoom to all vectors.
|
// Otherwise, zoom to all vectors.
|
||||||
if (Drupal.settings.farm_map.behaviors.wkt.zoom) {
|
if (Drupal.settings.farm_map.behaviors.wkt.zoom) {
|
||||||
|
|
Loading…
Reference in a new issue