Open JDeuce opened 12 years ago
I've traced through the code and believe I've found where it's making the decision about which orientation to open the popup:
https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Popup/Anchored.js#L149
If we ignore paddingForPopups for now then a simple fix might be to check here if a restrictedExtent has been set, and if so, use that instead of the map extent.
Any thoughts?
I tried out the above patch earlier today. It appears to resolve the issue on my development site (unfortunately non-public).
I forked the jsfiddle here http://jsfiddle.net/v4bss/ with a new version of the javascript. Note that at the current time I could only host the updated javascript file publicly through my google site. I couldn't get the popup background images to host at the required paths there, so they currently aren't loading correctly. However the fiddle should still be sufficient to see how the popup reacts with the restricted extent.
I have a map with bounds limited by restrictedExtent, and people are able to get a framed cloud popup with large height to open partially outside of the restricted Extents, causing it to be totally unusable (since the close button is hidden).
I'm filing this as a bug because I think OpenLayers should be opening the popup in a different orientation, since even though there are restrictedExtents, there is still available placements where the popup could be fully shown instead of partially hidden.
Here's a minimal jsfiddle showing the problem:
http://jsfiddle.net/VRWTw/
Note that you must click off the feature before clicking again to open a new popup.
Steps to open the popup normally:
Steps to open the popup so that it is blocked:
Things to keep in mind:
The calculation for which direction the popup should open should be done against the remaining viewport after taking into account the 'paddingForPopups'.