Autodesk forge 在Autodesk Forge中创建新面板

Autodesk forge 在Autodesk Forge中创建新面板,autodesk-forge,autodesk-viewer,Autodesk Forge,Autodesk Viewer,我创建了自己的按钮,没有任何onClick事件。我还扩展了默认属性面板。如何创建自己的面板并在单击以前创建的按钮后显示它 function ShowDocker(viewer) { SimplePanel = function(parentContainer, id, title, content, x, y) { this.content = content; Autodesk.Viewing.UI.DockingPanel.call(this, parentContaine

我创建了自己的按钮,没有任何onClick事件。我还扩展了默认属性面板。如何创建自己的面板并在单击以前创建的按钮后显示它

function ShowDocker(viewer) {

SimplePanel = function(parentContainer, id, title, content, x, y) {
    this.content = content;
    Autodesk.Viewing.UI.DockingPanel.call(this, parentContainer, id, '');
    // Auto-fit to the content and don't allow resize.  Position at the coordinates 
    //given.
    this.container.style.height = "auto";
    this.container.style.width = "auto";
    this.container.style.resize = "auto";
    this.container.style.left = x + "%";
    this.container.style.top = y + "%";
};

SimplePanel.prototype = Object.create(Autodesk.Viewing.UI.DockingPanel.prototype);
SimplePanel.prototype.constructor = SimplePanel;
SimplePanel.prototype.initialize = function() {
    // Override DockingPanel initialize() to:
    // - create a standard title bar
    // - click anywhere on the panel to move
    // - create a close element at the bottom right
    //
    this.title = this.createTitleBar(this.titleLabel || this.container.id);
    this.container.appendChild(this.title);
    this.closer = this.createCloseButton(); 
    this.container.appendChild(this.title);
   this.title.appendChild(this.closer);
   this.container.appendChild(this.content);

this.initializeMoveHandlers(this.title);
this.initializeCloseHandler(this.closer);
};
var tag = document.createElement('testdiv');
var text = document.createTextNode("Here goes your html");
tag.appendChild(text);
var docpanel = new SimplePanel(this.viewer.container, 'AllPropertiesPanels', 'All 
Properties', tag, 50, 80);
docpanel.setVisible(true);
}

尝试上述代码,您可以通过为面板指定可见性,使面板在单击按钮时显示和消失

docpanel.setVisible(true/false)
}

尝试上述代码,您可以通过为面板指定可见性,使面板在单击按钮时显示和消失

docpanel.setVisible(true/false)

或者,若您对显示自定义键值数据的更专业的面板感兴趣,可以参考其中一个,其中解释了如何实现这一点:

//对“属性面板”类进行子类化
类模型摘要面板扩展了Autodesk.Viewing.UI.PropertyPanel{
构造函数(查看器、容器、id、标题、选项){
超级(容器、id、标题、选项);
this.viewer=查看器;
}
}
let panel=new ModelSummaryPanel(查看器、viewer.container、“我的面板”、“我的面板”);
面板设置可见(真);
panel.addProperty(“键1”、“值1”、“类别1”);
panel.addProperty(“键2”、“值2”、“类别1”);
panel.addProperty(“键3”、“值3”、“类别1”);
panel.addProperty(“键A”、“值A”、“类别2”);

或者,如果您对显示自定义键值数据的更专业的面板感兴趣,您可以参考其中一个来解释如何实现这一点:

//对“属性面板”类进行子类化
类模型摘要面板扩展了Autodesk.Viewing.UI.PropertyPanel{
构造函数(查看器、容器、id、标题、选项){
超级(容器、id、标题、选项);
this.viewer=查看器;
}
}
let panel=new ModelSummaryPanel(查看器、viewer.container、“我的面板”、“我的面板”);
面板设置可见(真);
panel.addProperty(“键1”、“值1”、“类别1”);
panel.addProperty(“键2”、“值2”、“类别1”);
panel.addProperty(“键3”、“值3”、“类别1”);
panel.addProperty(“键A”、“值A”、“类别2”);