mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Enable the snapping grid controls when farmOS-map is used for editing #335
This commit is contained in:
parent
fd6e45ad19
commit
01e1f05c46
|
@ -25,6 +25,9 @@
|
|||
instance.addBehavior('edit');
|
||||
var layer = instance.edit.layer;
|
||||
}
|
||||
|
||||
// Add the snappingGrid behavior.
|
||||
instance.addBehavior('snappingGrid');
|
||||
}
|
||||
|
||||
// Enable the line/polygon measure behavior.
|
||||
|
|
|
@ -19,11 +19,7 @@
|
|||
};
|
||||
this.movementLayer = this.instance.addLayer('vector', opts);
|
||||
|
||||
// Make the layer editable.
|
||||
this.instance.addBehavior('edit', { layer: this.movementLayer });
|
||||
|
||||
// Add measure behavior.
|
||||
this.instance.addBehavior('measure', { layer: this.movementLayer});
|
||||
this.addEditBehaviors();
|
||||
},
|
||||
|
||||
// Update the assets current location map layer.
|
||||
|
@ -73,11 +69,7 @@
|
|||
};
|
||||
this.movementLayer = this.instance.addLayer('wkt', opts);
|
||||
|
||||
// Make the layer editable.
|
||||
this.instance.addBehavior('edit', { layer: this.movementLayer });
|
||||
|
||||
// Add measure behavior.
|
||||
this.instance.addBehavior('measure', { layer: this.movementLayer});
|
||||
this.addEditBehaviors();
|
||||
|
||||
// Zoom to all vector layers.
|
||||
this.instance.zoomToVectors();
|
||||
|
@ -94,6 +86,18 @@
|
|||
});
|
||||
},
|
||||
|
||||
// Adds behaviors for editing movements
|
||||
addEditBehaviors() {
|
||||
// Make the layer editable.
|
||||
this.instance.addBehavior('edit', { layer: this.movementLayer });
|
||||
|
||||
// Add the snappingGrid behavior.
|
||||
this.instance.addBehavior('snappingGrid');
|
||||
|
||||
// Add measure behavior.
|
||||
this.instance.addBehavior('measure', { layer: this.movementLayer});
|
||||
},
|
||||
|
||||
// Make sure this runs after farmOS.map.behaviors.wkt.
|
||||
weight: 101,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue