如何使用鼠标滚轮事件移动剖面
How to move the section plane with a mouse wheel event
我们的一位用户要求模仿其他软件的用户体验。
目前我们创建一个剖面,用鼠标移动黄色箭头。
是否可以使用组合键(shift + 鼠标滚动事件)沿箭头方向移动创建的截面。
如果是这样,有人能指出我正确的方向吗?
您可以通过编程方式控制当前剖面,如下所示:
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
我们的一位用户要求模仿其他软件的用户体验。
目前我们创建一个剖面,用鼠标移动黄色箭头。 是否可以使用组合键(shift + 鼠标滚动事件)沿箭头方向移动创建的截面。
如果是这样,有人能指出我正确的方向吗?
您可以通过编程方式控制当前剖面,如下所示:
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