viewer.canvas.onmousemove=function(e,a){
var theNode=viewer.impl.hitTest(e.x,e.y,false);//这个函数的作用就是获取鼠标位置的构建id(dbId)
if(theNode)
{
//viewer.clearSelection();
viewer.toggleSelect(theNode.dbId);
}
};
var theMap=new Map();
for(var x=200;x<600;x=x+3)
{
for(var y=200;y<600;y=y+3)
{
var theNode = viewer.impl.hitTest(x,y,true);
if(theNode)
{
theMap.set(theNode.dbId,theNode.model);
}
}
}
theMap.forEach(function(sender,key,val){viewer.toggleSelect(key);});
BIM手记(3) mousemove
最新推荐文章于 2024-03-22 17:52:43 发布
博客给出两段代码,第一段为viewer鼠标移动事件代码,通过hitTest函数获取鼠标位置构建id,若存在则进行节点选择操作;第二段代码利用双重循环遍历特定区域,使用hitTest获取节点信息并存储在Map中,最后遍历Map进行节点选择。
2559

被折叠的 条评论
为什么被折叠?



