我正在实现 OpenLayers SelectFeature 控件,并尝试将 JQuery UI 对话框小部件放置在所选功能的正上方。要使用 JQuery UI Position 实用程序,它需要 DOM 元素或事件。
SelectFeature 控件的 onSelect 回调为我提供了一个代表所选要素的 OpenLayers.Feature.Vector 对象。由此,我如何获取所选功能的 DOM 元素或单击事件的 Event 对象?
var selectControl = new OpenLayers.Control.SelectFeature(clientsLayer, {
hover : false,
clickout: false,
multiple: false,
onSelect: function(feature) {
// how do I get the DOM element of the feature
// or alternately, the click event of the selection?
}
});
你做得对。
如果你做一个console.log(feature)
您会看到它返回一个 CLASS_NAME = 的对象
“OpenLayers.Feature.Vector”
onSelect: function(feature) {
console.log(feature);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)