[OpenLayers-Users] Problem with display: none on unselect
Grzegorz Kowal
wolktm at gmail.com
Wed Apr 7 09:37:03 EDT 2010
Hello,
I have ClusterStrategy On Vector Layer. On select I'm showing a popup.
function createPopup(feature){
if(popup){
onFeatureUnselect(feature);
}
popup = new OpenLayers.Popup.FramedCloud("feed",
new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y),
new OpenLayers.Size(300,120),
"abc", null,
true, onPopupClose);//, onPopupClose
popup.autoSize= false;
map.addPopup(popup);
}
Please notice that I'm *not *adding "popup" to "feature".
My problem is that on unselect feature (as a picture on the map) is not
visible. I can still see it in debug in firebug.
I tracked the problem down to the following:
drawFeature in OpenLayers/Renderer.js
var bounds = feature.geometry.getBounds();
if (!bounds.intersectsBounds(this.extent)) {
style = {display: "none"};
}
When I checked the "bounds" they are in EPSG:4326 and "this.extent" is in
EPSG:900913. In my application I'm using EPSG:900913.
This means that bounds.intersectsBounds(this.extent) will always return
false.
I have found a workaround, I transform feature.geometry.bounds
from EPSG:4326 to EPSG:900913 but this means dirty code and results in some
other quirks (that's exactly why I use new
OpenLayers.LonLat(feature.geometry.x, feature.geometry.y), instead
of feature.geometry.getBounds().getCenterLonLat()) .
Looks to me like a bug but maybe I'm doing something wrong?
--
salut
#geko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100407/7846e9bf/attachment.html
More information about the Users
mailing list