opensourceBIM / bimvie.ws

Javascript client for Building Information Modelling, using open standards like IFC, BCF and BIMSie. Using Bootstrap, BIM Surfer, etc..
GNU Affero General Public License v3.0
170 stars 85 forks source link

how to modify the speed of panning and zooming when mouse move and mouse wheel scroll #110

Open zyjiang0571 opened 5 years ago

zyjiang0571 commented 5 years ago

Hi all, I want to make some change of PickFlyOrbit parameter. So, I add some code in 3dview.html, see the following:

this.load = function(){
        var promise = new BimServerApiPromise();
        debugger
        o.viewer = new BIMSURFER.Viewer(Global.bimServerApi, 'viewport');
        Global.viewer = o.viewer;  // added by jiang
        $(window).resize(o.resize);
        o.resize();
        o.viewer.loadScene(function(){
            Global.scene = o.viewer.scene;          
            debugger;
                        var clickSelect = o.viewer.getControl("BIMSURFER.Control.ClickSelect");         
                    clickSelect.activate();
                    clickSelect.events.register('select', o.nodeSelected);
            clickSelect.events.register('unselect', o.nodeUnselected);
                        // added by me ---begin
                   var panOrbit = o.viewer.getControl("BIMSURFER.Control.PickFlyOrbit");                        
                   panOrbit.activate();         
                  panOrbit.rate = panOrbit.rate * 5;
                  var eyepos = {x: 0.0, y: 1.0, z: 1.0};
                  panOrbit.eye = eyepos;            
                  alert("loadScene's callback");
                  // added by me ---end
                  promise.fire();
             }, {useCapture: true});
    return promise;
};

But it does not work! And, I found that the activate() function of PickFlyOrbit is called twice. The 1st time is in the above callback function. The 2nd time is called by bimviews itselft. So it does not work and I think I should change the parameter(such as the rate) after the 2nd time call of activate(). So, how can I do?