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
|
* @type Boolean
|
||||||
*/
|
*/
|
||||||
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);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user