问题描述
我有两个查看器来比较模型.我为属性创建了一个停靠面板,我希望这个面板在两个查看器中浮动.有没有可能,谁会告诉你怎么做?
I have two viewers to compare models. I created a docking panel for properties, and I want this panel to float in two viewers. Is it possible and who will tell you how to do it?
推荐答案
好的,还有两个选项:
选项 A:如果第二张图片是静态的"...为什么不直接拍一张截图"并将其放在右侧面板中?您可以使用 viewer.getScreenShot() 命令检索 PNG 博客,并将其绘制到画布中.
option A:if the second image is 'static'... why not just take a 'screenshot' and place it in the right side panel?You can use the viewer.getScreenShot() command to retrieve a PNG blog, and paint it into the canvas.
// Get the full image
viewer.getScreenShot(viewer.container.clientWidth, viewer.container.clientHeight, function (blobURL) {
screenshot.src = blobURL;
});
有关在画布上绘制图像的更多详细信息,请参见此处:https://forge.autodesk.com/blog/screenshot-markups
For more details on drawing images to a canvas, see here: https://forge.autodesk.com/blog/screenshot-markups
选项 B:如果两个面板可以独立控制,那么也许可以尝试通过某种按钮按下(或动作)来同步相机状态.
option B:if the two panels can be independently controlled, then perhaps try to sync the camera state, with some kind of button press (or action).
借助这些博客文章:
- https://forge.autodesk.com/blog/map-forge-viewer-camera-back-navisworks
- 获取相机位置并在 Forge Viewer 中恢复以进行虚拟访问
例如:
viewer.getState();
viewer.restoreState();
或使用导航对象恢复相机位置:
or restore camera position using navigation object:
const nav = this.navigation;
nav.getTarget();
nav.getPosition();
nav.getCameraUpVector();
这篇关于我可以在 Autodesk forge 中为两个查看器使用停靠面板吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!