
function Crosshair() {
this.div = null;
this.dummydiv = null;
this.image = new Image();
this.image.src = '/img/crosshair.gif';
}
Crosshair.prototype = new GControl(false, false);
Crosshair.prototype.unload = function() {
this.div.parentNode.removeChild(this.div);
}
Crosshair.prototype.initialize = function(map) {
this.map = map;
this.div = $Div();
this.div.style.position = 'absolute';
var img = $Element('img');
img.src = this.image.src;
img.style.width = '15px';
img.style.height = '15px';
this.div.appendChild(img);
this.map.getPane(G_MAP_MAP_PANE).appendChild(this.div);
this.dummydiv = $Div();
this.dummydiv.style.display = 'none';
this.map.getContainer().appendChild(this.dummydiv);
this.update();
return this.dummydiv;
}
Crosshair.prototype.getDefaultPosition = function() {
return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 35));
}
Crosshair.prototype.update = function() {
var position = this.map.fromLatLngToDivPixel(this.map.getCenter());
this.div.style.left = (position.x - 7) + 'px';
this.div.style.top = (position.y - 7) + 'px';
}
