You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's some behavior code to replicate against - this is where we discovered the issue. The behavior handles copying WKT from the input field under the map into the drawing layer.
(function () {
farmOS.map.behaviors.wkt_refresh = {
attach: function (instance) {
// Get the wkt input element.
var wkt = document.getElementById('edit-mymap-value');
// Run a handleInput() callback when input changes.
wkt.oninput = handleInput;
function handleInput(e) {
if (wkt.value) {
// Clear features from the current edit layer's source.
instance.edit.layer.getSource().clear();
// Add a new temporary invisible WKT layer.
var layer = instance.addLayer('wkt', {
title: 'WKT',
wkt: wkt.value,
visible: false,
});
// Copy features from the WKT layer to the edit layer.
instance.edit.layer.getSource().addFeatures(layer.getSource().getFeatures());
// Remove the temporary WKT layer.
instance.map.removeLayer(layer);
// Zoom to the edit layer.
instance.zoomToLayer(instance.edit.layer);
} else if (wkt.value === '') {
// Clear features from the current edit layer's source.
instance.edit.layer.getSource().clear();
}
}
},
// Make sure this runs after farmOS.map.behaviors.wkt.
weight: 101
};
}());
(Note this currently assumes a map named mymap for the ID matching in var wkt = document.getElementById('edit-mymap-value');)
We probably need to update this to honor layers being removed(/changed?):
farmOS-map/src/behavior/layerSwitcherInSidePanel.js
Lines 46 to 49 in 777758f
Also relevant: walkermatt/ol-layerswitcher#98
The text was updated successfully, but these errors were encountered: