add first draft of onScreen() function to marker

git-svn-id: http://svn.openlayers.org/trunk/openlayers@532 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-06-06 17:07:51 +00:00
parent 450f7b0460
commit 9e5059a93c

View File

@@ -59,6 +59,24 @@ OpenLayers.Marker.prototype = {
}
},
/**
* @returns Whether or not the marker is currently visible on screen.
* @type Boolean
*/
onScreen:function() {
var screenBounds = OpenLayers.Bounds.fromSize(this.map.getSize());
var iconTop = parseInt(this.icon.div.style.top);
var iconLeft = parseInt(this.icon.div.style.left);
var iconBottom = iconTop + parseInt(this.icon.div.style.height);
var iconRight = iconLeft + parseInt(this.icon.div.style.width);
var iconBounds =
new OpenLayers.Bounds(iconLeft, iconBottom, iconRight, iconTop);
return screenBounds.containsBounds(iconBounds, true);
},
/**
* @param {float} inflate
*/