简体   繁体   English

如何在 Forge Viewer v7 中折叠 PropertyPanel 中的类别?

[英]How do you collapse a category in PropertyPanel in Forge Viewer v7?

I'm using the Forge Viewer to display properties on selected items in my model.我正在使用 Forge Viewer 显示我的 model 中所选项目的属性。

When an object is selected, I want to automatically show the properties panel but keep a category collapsed.选择 object 时,我想自动显示属性面板但保持类别折叠。 Here's the code I'm using in an attempt to achieve this:这是我试图实现此目的的代码:

        viewer.addEventListener(
          Autodesk.Viewing.SELECTION_CHANGED_EVENT, 
          () => {
            const panel = viewer.getPropertyPanel();
            panel.setVisible(true);
            panel.setCategoryCollapsed("Category Name", true);
          },  
        );

The event is raised and the panel is shown, however, the function setCategoryCollapsed does not work (understandable as it was last documented in v5 ).引发事件并显示面板,但是 function setCategoryCollapsed不起作用(可以理解,因为它最后记录在 v5 中)。 Is there a similar function in v7 to collapse a category? v7中有没有类似function收一个分类的?

That function expects an object with name and type properties - eg if I wanted to collapse the "Graphics" category, I could do it like this: function 需要一个具有名称类型属性的 object - 例如,如果我想折叠“图形”类别,我可以这样做:

const panel = viewer.getPropertyPanel();
panel.setVisible(true);
panel.setCategoryCollapsed({name: "Graphics", type: "category"}, true);

Have also just written a blog post about it now: Collapse category in the Property Panel现在也刚刚写了一篇关于它的博客文章: Collapse category in the Property Panel

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM