首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何移动带鼠标轮事件的截面平面

如何移动带鼠标轮事件的截面平面
EN

Stack Overflow用户
提问于 2020-10-15 13:42:56
回答 1查看 68关注 0票数 0

我们的一个用户有这个请求来模仿不同软件的用户体验。

目前,我们创建一个截面平面,并移动黄色箭头与鼠标。是否可以用键组合(shift +鼠标滚动事件)沿着箭头的方向移动创建的区段平面。

如果是的话,有人能给我指明正确的方向吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-15 14:19:28

您可以通过编程控制当前区段平面,如下所示:

代码语言:javascript
运行
复制
function moveSectionPlaneByDelta(viewer, delta) {
    // Assuming that section tool is active
    const sectionTool = viewer.toolController.getActiveTool();
    const sectionPlanes = sectionTool.getSectionPlanes();
    if (sectionPlanes.length === 1) {
        const normal = new THREE.Vector3(sectionPlanes[0].x, sectionPlanes[0].y, sectionPlanes[0].z);
        const position = normal.clone().multiplyScalar(-sectionPlanes[0].w + delta);
        sectionTool.setSectionPlane(normal, position);
    }
}

// ...

moveSectionPlaneByDelta(viewer, 5.0); // move in the direction of the plane normal
moveSectionPlaneByDelta(viewer, -5.0); // move against the direction of the plane normal
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64372916

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档