【问题标题】:How to move the section plane with a mouse wheel event如何使用鼠标滚轮事件移动剖面
【发布时间】:2021-01-30 00:24:39
【问题描述】:

我们的一位用户提出此请求,以模仿不同软件的用户体验。

目前我们创建一个剖面并用鼠标移动黄色箭头。 是否可以通过组合键(shift + 鼠标滚动事件)沿箭头方向移动创建的剖面。

如果是这样,有人能指出我正确的方向吗?

【问题讨论】:

    标签: autodesk-forge autodesk-viewer


    【解决方案1】:

    您可以通过编程方式控制当前剖面,如下所示:

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-29
      • 2010-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多