我尝试使用Select [Name],
Places = Stuff((Select ', '+Place from yourtable where [Name] = t.[Name] for xml path('')),1,2,'')
from yourtable
group by [Name]
将多边形添加到openlayers地图中。我也有一个Snap互动,并设置为在我按住班次时关闭。
ol.interaction.Draw
这可以禁用捕捉。但是,当我按住shift时,我的Draw交互并不起作用。我知道const
snapInteraction = new ol.interaction.Snap({
source: drawLayer.getSource()
}),
turnOnSnap = (evt) => {
if (!isShiftKey(evt)) {
return;
}
console.log('shift key is down, turning off snap');
snapInteraction.setActive(false);
},
turnOffSnap = (evt) => {
if (!isShiftKey(evt)) {
return;
}
console.log('shift key is up, turning on snap');
snapInteraction.setActive(true);
};
document.addEventListener('keydown', turnOnSnap);
document.addEventListener('keyup', turnOffSnap);
参数默认为condition
,但当我制作自定义ol.events.condition.noModifierKeys
时,它甚至不会被击中!
condition
为什么drawInteraction忽略shift + click事件?
答案 0 :(得分:1)
const drawInteraction = new ol.interaction.Draw({
source: drawLayer.getSource(),
type: 'Polygon',
condition: function (evt) {
console.log("yo, why isn't this hit when I hold down shift?", evt);
return (ol.events.condition.noModifierKeys(evt) ||
ol.events.condition.shiftKeyOnly(evt));
}
});
的默认设置是捕捉shift +点击事件,因此永远不会对freehandCondition
进行评估。将其更改为其他内容,shift + click事件将触及您的自定义条件函数。
condition