2017-01-12 4 views
0

ドッキングパネルのサイズを変更するにはどうすればよいですか?ドッキングパネルでスクロールコンテナを作成するには?ドッキングパネルのサイズ変更とスクロールコンテナ

私は、この回答に記載されているシンプルパネルでドッキングパネルを拡張しましたHow to create a Docking Panelです。それで、理想的には、ドッキングパネルを作成するときに、それらを作る方法を知っているでしょう。

SimplePanel.prototype.initialize = function() 

答えて

1

私はエクステンションの仕組みを好みます。あなたがそれを自己完結したJavaScriptファイルを定義することができます。ここに例があります。 style.resize = "auto"コード行と他の要素(例えば、他の要素がいっぱいのDIVなど)との対応方法appendChildこの拡張機能では、viewer.loadExtension()に電話するだけです。

AutodeskNamespace('Autodesk.ADN.Viewing.Extension'); 

Autodesk.ADN.Viewing.Extension.MyExtension = function (viewer, options) { 
    Autodesk.Viewing.Extension.call(this, viewer, options); 

    var _self = this; 

    /////////////////////////////////////////////////////////////////////////// 
    // load callback 
    /////////////////////////////////////////////////////////////////////////// 
    _self.load = function() { 

    // need to access geometry? wait until is loaded 
    viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function() { 
     createDockPanel(); 
    }); 

    return true; 
    }; 

    var _dockPanel; 

    function createDockPanel() { 
    _dockPanel = new Autodesk.Viewing.UI.DockingPanel(viewer.container, 'ecom', 'Cart'); 

    _dockPanel.container.style.top = "10px"; 
    _dockPanel.container.style.left = "10px"; 

    _dockPanel.container.style.width = "auto"; 
    _dockPanel.container.style.height = "auto"; 
    _dockPanel.container.style.resize = "auto"; 

    _dockPanel.container.appendChild(document.getElementById(‘someOtherElement’)); // for instance, a DIV 

    _dockPanel.setVisible(true); 
    } 


    /////////////////////////////////////////////////////////////////////////// 
    // unload callback 
    /////////////////////////////////////////////////////////////////////////// 
    _self.unload = function() { 
    _dockPanel.setVisible(false) 
    return true; 
    }; 
}; 

Autodesk.ADN.Viewing.Extension.MyExtension.prototype = Object.create(Autodesk.Viewing.Extension.prototype); 

Autodesk.ADN.Viewing.Extension.MyExtension.prototype.constructor = Autodesk.ADN.Viewing.Extension.MyExtension; 

Autodesk.Viewing.theExtensionManager.registerExtension('Autodesk.ADN.Viewing.Extension.MyExtension', Autodesk.ADN.Viewing.Extension.MyExtension); 
関連する問題