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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user