Skip to content

Commit

Permalink
Merge pull request #12 from g3w-suite/fix-zoom-to-geometry-on-edit-fr…
Browse files Browse the repository at this point in the history
…om-result

Fix zoom to geometry on edit from result
  • Loading branch information
volterra79 committed Jan 12, 2023
2 parents b660b0d + 8a3b960 commit 3b1145b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "editing",
"version": "3.5.0",
"version": "3.5.2",
"description": "",
"main": "index.js",
"directories": {
Expand Down
10 changes: 7 additions & 3 deletions services/editingservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,6 @@ proto.editResultLayerFeature = function({layer, feature}={}){
map.getView().setResolution(resolution);
}
});
// zoom to feature geometry
this._mapService.zoomToGeometry(feature.geometry);
}
// start toolbox
toolBox.start({
Expand All @@ -280,8 +278,14 @@ proto.editResultLayerFeature = function({layer, feature}={}){
}
})
.then(({features=[]}) => {
const feature = features.find(feature => feature.getId() == featureId);
//const feature = features.find(feature => feature.getId() == featureId);
/**
*
* Need to get feature from Editing layer source because it has a style layer
*/
const feature = toolBox.getLayer().getEditingLayer().getSource().getFeatures().find(feature => feature.getId() == featureId);
if (feature){
feature.getGeometry() && this._mapService.zoomToGeometry(feature.getGeometry());
toolBox.setSelected(true);
const session = toolBox.getSession();
this.setSelectedToolbox(toolBox);
Expand Down

0 comments on commit 3b1145b

Please sign in to comment.