私のプログラムの以前のバージョンでは、markers
を使って地図上のポイントに印を付けました。現在のバージョンでは、私はmarkers
からvectors
に変更する必要があったため、余分な柔軟性が必要でした。OpenLayersのベクターにポップアップボックスを追加するには?
function createPopupBoxFeature(vector, lonLat, description) {
var feature = new OpenLayers.Feature(vector, lonLat);
feature.closeBox = true;
feature.popupClass = OpenLayers.Class(OpenLayers.Popup.AnchoredBubble,
{ "autoSize": true });
feature.data.popupContentHTML = description;
vector.events.register("mousedown", feature, function(evt) {
if (this.popup == null) {
this.popup = this.createPopup(this.closeBox);
map.addPopup(this.popup);
this.popup.show();
} else {
this.popup.toggle();
}
OpenLayers.Event.stop(evt);
});
return feature;
}
をしかし、彼らは何のevents
性質を持っていないので、それはもはや、vectors
のために働いている:マーカー・ソリューションでは、私は、マーカーにポップアップボックスを追加するには、以下の機能を使用しません。これをどうやって解決するのですか?