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
2 changed files with 17 additions and 10 deletions
|
@ -25,6 +25,9 @@
|
||||||
instance.addBehavior('edit');
|
instance.addBehavior('edit');
|
||||||
var layer = instance.edit.layer;
|
var layer = instance.edit.layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the snappingGrid behavior.
|
||||||
|
instance.addBehavior('snappingGrid');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable the line/polygon measure behavior.
|
// Enable the line/polygon measure behavior.
|
||||||
|
|
|
@ -19,11 +19,7 @@
|
||||||
};
|
};
|
||||||
this.movementLayer = this.instance.addLayer('vector', opts);
|
this.movementLayer = this.instance.addLayer('vector', opts);
|
||||||
|
|
||||||
// Make the layer editable.
|
this.addEditBehaviors();
|
||||||
this.instance.addBehavior('edit', { layer: this.movementLayer });
|
|
||||||
|
|
||||||
// Add measure behavior.
|
|
||||||
this.instance.addBehavior('measure', { layer: this.movementLayer});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Update the assets current location map layer.
|
// Update the assets current location map layer.
|
||||||
|
@ -73,11 +69,7 @@
|
||||||
};
|
};
|
||||||
this.movementLayer = this.instance.addLayer('wkt', opts);
|
this.movementLayer = this.instance.addLayer('wkt', opts);
|
||||||
|
|
||||||
// Make the layer editable.
|
this.addEditBehaviors();
|
||||||
this.instance.addBehavior('edit', { layer: this.movementLayer });
|
|
||||||
|
|
||||||
// Add measure behavior.
|
|
||||||
this.instance.addBehavior('measure', { layer: this.movementLayer});
|
|
||||||
|
|
||||||
// Zoom to all vector layers.
|
// Zoom to all vector layers.
|
||||||
this.instance.zoomToVectors();
|
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.
|
// Make sure this runs after farmOS.map.behaviors.wkt.
|
||||||
weight: 101,
|
weight: 101,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue