Autodesk forge 如何创建停靠面板

Autodesk forge 如何创建停靠面板,autodesk-forge,autodesk-viewer,Autodesk Forge,Autodesk 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 res

如何创建停靠面板?我正在使用示例中的代码 它应该继承并重写所需的方法

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 = "none";
  this.container.style.left = x + "px";
  this.container.style.top = y + "px";
};

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.container.appendChild(this.content);
  this.initializeMoveHandlers(this.container);

  this.closer = document.createElement("div");
  this.closer.className = "simplePanelClose";
  this.closer.textContent = "Close";
  this.initializeCloseHandler(this.closer);
  this.container.appendChild(this.closer);
};
在此之后,我使用以下命令调用创建的简单面板:

var parent = document.getElementsByClassName('adsk-viewing-viewer')[0];
var panel = SimplePanel(parent, 'panel1', 'panel1');
返回错误: “未捕获类型错误:this.setVisible不是DockingPanel上的函数(viewer3D.js?v=2.11:343)”

它似乎是从

Autodesk.Viewing.UI.DockingPanel.call(this, parentContainer, id, '');

然后在里面崩溃


在查看器停靠面板功能中,“this”似乎是指窗口元素。也许应该是别的什么?例如,当查看者创建搜索窗口时,它似乎引用了某个div。

我没有收到像您这样的错误,但我遇到了另一个由空内容引起的问题。所以我显式地创建了一个div作为参数的内容。此外,还需要宽度和高度,否则面板将不会显示

面板类如下所示

SimplePanel=function(父容器、id、标题、内容、x、y)
{
this.content=内容;
调用(this,parentContainer,id,title,{shadow:false});
//自动适应内容,不允许调整大小。定位在给定的坐标处。
//
this.container.style.height=“150px”;
this.container.style.width=“450px”;
this.container.style.resize=“auto”;
this.container.style.left=x+“px”;
this.container.style.top=y+“px”;
};
SimplePanel.prototype=Object.create(Autodesk.Viewing.UI.DockingPanel.prototype);
SimplePanel.prototype.constructor=SimplePanel;
SimplePanel.prototype.initialize=函数()
{ 
this.title=this.createTitleBar(this.titleLabel | | this.container.id);
this.container.appendChild(this.title);
this.container.appendChild(this.content);
this.initializeMoveHandlers(this.container);
this.closer=this.createCloseButton();
this.title.appendChild(this.closer);
var op={left:false,heightAdjustment:45,marginTop:0};
this.scrollcontainer=this.createScrollContainer(op);
变量html=[
'',
'',
'',
'',
“NameStatusFoundApproved ByDescription”,
'',
'',
“测试”,
“测试”,
“测试”,
“测试”,
“测试”,
“测试”,
“测试”,
'',
'',
'',
''
].join('\n');
$(this.scrollContainer).append(html);
this.initializeMoveHandlers(this.title);
this.initializeCloseHandler(this.closer);

};拥有面板后如何创建scrollContainer?我在initialize函数中尝试了这个.createScrollContainer(),但没有成功。对于关闭按钮this.closeButton=this.createCloseButton();this.container.appendChild(this.closeButton);如果可以的话,我也试着用同样的逻辑添加滚动容器,但是没有成功。resizeToContent()怎么样,我需要提供一些选项吗?目前面板只是跳得更低,它没有调整面板的大小。嗨,我用一个滚动容器编辑了上面的代码。您能检查一下它是否能帮助您诊断您这边的问题吗?这段代码没有显示面板,但这段代码显示了-上面的代码是用以前的版本查看器测试的。可能需要使用较新的查看器更新某些内容。。
var DockingPanel = function (parentContainer, id, title, options) {