Re: zoom for HTML5 tool file is weak compared to program zoom

by PacWood » Wed Mar 14, 2018 7:42 am

Hello,

Thank you for your help.
Yes, the HPC.getUserPreferences should have been HPC.getUserPreferences()
with the parenthesis. Thank you.

I have noticed that there is still an "undefined" error when I use
the obj returned by HPC.getUserPreferences() with the code below.

I set a break point to follow the error, and then the "undefined" error when away
and I can see in the UP variable that the "AerialViewCenteredOnSelectionEnabled" was set to 'true'.

It then occurred to me there is a timing issue.

The UserPreferences obj returned by HPC.getUserPreferences() is undefined until after the "Home" is loaded.

How can I tell when the "Home" is loaded?

Is there some global flag somewhere that I can periodically check to make sure the "Home" is loaded into memory?

I am thinking that after the "Home" is loaded,
then I can safely call "HPC.getUserPreferences();"

Below is the code being used now:

Code: Select all

<script>
  var HPC =  viewHome("viewerCanvas",   
           homeUrl,          
           onerror,           
           onprogression,    
          { roundsPerMinute: 0,                
            navigationPanel: "default",                                           
            levelsAndCamerasListId: "levelsAndCameras",         
            selectableLevels: ["Level 1", "Level 2"],     
            activateCameraSwitchKey: true                      
          });  
    
    
   console.log('AAAA');
   var UP = HPC.getUserPreferences();
   console.log('BBBB');
   UP.setAerialViewCenteredOnSelectionEnabled(true);
   console.log('CCCC');
<script>
Thank you much.