dont worry about checking for the corners of the marker. just check the lonlat. that is good enough

git-svn-id: http://svn.openlayers.org/trunk/openlayers@534 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-06-07 13:02:14 +00:00
parent 7cc874d26b
commit c2832cf83a

View File

@@ -65,16 +65,12 @@ OpenLayers.Marker.prototype = {
*/ */
onScreen:function() { onScreen:function() {
var screenBounds = OpenLayers.Bounds.fromSize(this.map.getSize()); var onScreen = false;
if (this.map) {
var iconTop = parseInt(this.icon.div.style.top); var screenBounds = this.map.getExtent();
var iconLeft = parseInt(this.icon.div.style.left); onScreen = screenBounds.contains(this.lonlat.lon, this.lonlat.lat);
var iconBottom = iconTop + parseInt(this.icon.div.style.height); }
var iconRight = iconLeft + parseInt(this.icon.div.style.width); return onScreen;
var iconBounds =
new OpenLayers.Bounds(iconLeft, iconBottom, iconRight, iconTop);
return screenBounds.containsBounds(iconBounds, true);
}, },
/** /**