USA
Joined: Mar 13, 2018
Post Count: 8
Status:
Offline
zoom for HTML5 tool file is weak compared to program zoom
Hello,
When I do a "Tools > Export to HTML5" , the .html file viewHomeInOverlay.html contains the building that I have been working on and it looks good.
However, when I zoom in on 3d view of the building, there appears to be a limit with the zoom for 3d aerial view. (In the viewHomeInOverlay.html that was created by the "Export to HTML5")
The building is 330 feet in x direction and 100 feet in y direction and it is 2 floors. (it is a warehouse)
In comparison, while view the same building in the "Sweet Home 3d" program, the zoom for the 3d aerial view is very good zoom. I am able to zoom in on furniture very well and see even the kitchen sink in detail. The zoom is very powerful in the Sweet Home 3d program, though it too has a zoom limit.
The zoom with the viewHomeInOverlay.html file that contains the 3d view from the "Export to HTML5" tool is not nearly as powerful as the zoom in the Sweet Home 3d program.
I thought maybe the warehouse is too big, so for a test, I made a simple 1 floor house and the zoom for the 3d aerial view is still limited in the .html file that is created by the "Export to HTML5". (Limited meaning the zoom is not as powerful as the zoom in the Sweet Home 3d program 3d view)
Does anyone also see a limitation with the zooming feature on the 3d aerial view in the html file from the "Tools > Export to HTML5" ?
On a side note, if I set the width=4000 and height=1600 for the canvas in the .html file, then the 3d view is very large and I can see the furniture much better. But, the webpage is much less than 4000x1600 px.
Maybe there is some setting that needs to be set prior to doing the "Export to HTML5"? or is there some javascript object setting to set the maximum zoom in the viewHomeInOverlay.html file?
I have searched the forums but it appears no one has noticed the .html file has a lesser zoom for the 3d view than the 3d view in the Sweet Home 3d program.
Any help or suggestions to make the zoom better for the .html file is very appreciated.
France
Joined: Nov 7, 2005
Post Count: 9425
Status:
Offline
Re: zoom for HTML5 tool file is weak compared to program zoom
When the selection is empty, you can't get closer than the limits of the bounding box of your home. But you probably activated the Aerial view centered on selection option in Sweet Home 3D preferences panel and selected an object in your home, in which case you can get closer. You can reproduce the same behavior in Sweet Home 3D JS, by setting the same option and selecting an object by program. Just call setAerialViewCenteredOnSelectionEnabled and setSelectedItems. See also omrico request here.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
USA
Joined: Mar 13, 2018
Post Count: 8
Status:
Offline
Re: zoom for HTML5 tool file is weak compared to program zoom
Hello,
Thank you for your fast reply.
You are correct that I activated the Aerial view centered on selection option in Sweet Home 3D preferences panel and selected an object in my buiding and was able to get closer.
As you suggested, I read omrico's thread. In omrico's thread, there is the statement: "The HomePreviewComponent returned by viewHome has access to UserPreferences."
I was hoping to do the following:
var HPC = viewHome(...); var UP = HPC.getUserPreferences; UP.setAerialViewCenteredOnSelectionEnabled(true);
But the browser states that the variable "UP" is undefined.
France
Joined: Nov 7, 2005
Post Count: 9425
Status:
Offline
Re: zoom for HTML5 tool file is weak compared to program zoom
In JavaScript, you have to put some parenthesis after a method even if it takes no parameter.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
USA
Joined: Mar 13, 2018
Post Count: 8
Status:
Offline
Re: zoom for HTML5 tool file is weak compared to program zoom
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();"
console.log('AAAA'); var UP = HPC.getUserPreferences(); console.log('BBBB'); UP.setAerialViewCenteredOnSelectionEnabled(true); console.log('CCCC'); <script>
function myTimer() { var UP = HPC.getUserPreferences(); var HOME = HPC.getHome(); var items = HOME.getSelectableViewableItems(); console.log(items); UP.setAerialViewCenteredOnSelectionEnabled(true); console.log('CCCC'); var itemSel = ["209","210"]; HOME.setSelectedItems(itemSel); } </script>
Included at the bottom of this post is a screen shot. The building is on the left and the list of selectable items is shown in the console.
function myTimer() { var UP = HPC.getUserPreferences(); var HOME = HPC.getHome(); var items = HOME.getSelectableViewableItems(); console.log(items); UP.setAerialViewCenteredOnSelectionEnabled(true); var itemSel = [items[210]]; HOME.setSelectedItems(itemSel); console.log(HOME); } </script>
France
Joined: Nov 7, 2005
Post Count: 9425
Status:
Offline
Re: zoom for HTML5 tool file is weak compared to program zoom
It's great that you could achieve it by yourself As you finally found out, setSelectedItems method takes an array of objects (furniture, walls or other objects stored in a Home instance) and not an array of numbers or quoted numbers.
How can I tell when the "Home" is loaded?
The home loading process can be tracked in the onprogression callback. Just change the existing callback in the condition part === HomeRecorder.READING_HOME. Doing so will be much safer than programming a timer with a delay that may vary with bandwidth and CPU power.
Thanks for the donation
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator