Hi All,
I have a search widget and it's using our own layer source (feature service, polygon). When I click the search result it will zoom to the selected polygon extent and the polygon occupied the whole map content screen. Can the search result not to zoom in too close? is there anyway to customize it?
thanks,
Wilson
Solved! Go to Solution.
Normally that means you have introduced a syntax error in the changes you made.
that's what i figured but i can't see to figure out where. All i did was add these two lines.
Went from
if (result &&
result.name &&
title === result.name.toString() &&
dIdx === dataIndex.toString() &&
dsIndex === dataSourceIndex.toString()) {
html.addClass(li, 'result-item-selected');
}
}));
//var layer = this.map.getLayer(sourceLayerId);
var layerInfo = this.layerInfosObj.getLayerInfoById(sourceLayerId);
To this.
if (result &&
result.name &&
title === result.name.toString() &&
dIdx === dataIndex.toString() &&
dsIndex === dataSourceIndex.toString()) {
html.addClass(li, 'result-item-selected');
}
}));
var pt = result.feature.geometry.getCentroid();
this.map.centerAndZoom(pt, 2); //Change this to suit your needs
},
//var layer = this.map.getLayer(sourceLayerId);
var layerInfo = this.layerInfosObj.getLayerInfoById(sourceLayerId);
CC Weedcontrol,
So the issue is this line 10 in your new code then. notice that "}," was not at that location in you original code.