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:
@@ -64,17 +64,13 @@ OpenLayers.Marker.prototype = {
|
||||
* @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);
|
||||
|
||||
var onScreen = false;
|
||||
if (this.map) {
|
||||
var screenBounds = this.map.getExtent();
|
||||
onScreen = screenBounds.contains(this.lonlat.lon, this.lonlat.lat);
|
||||
}
|
||||
return onScreen;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user