Joined: Jan 13, 2016
Post Count: 21
Status:
Offline
Re: Sweet Home 3D JS Online
I would like to use the floor plan designer in such a way that it can be used on desktop, tablet and mobile.
For example, the user goes to an apartment and draws the floor plan on a mobile phone, then completes it on the desktop computer and prints it out.
I found several problems. The biggest problem is that the canvas on the mobile version and the desktop version have different sizes, so they are not compatible with each other.
The second problem, which is also present in the desktop version, is that the parts of the floor plan that are too large, protruding from the visible surface, are not placed on the saved image (the floor plan view must be reduced so that the entire floor plan is visible, i.e. the entire canvas is not placed on it to jpg, only the visible part of the canvas).
France
Joined: Nov 7, 2005
Post Count: 9388
Status:
Offline
Re: Sweet Home 3D JS Online
As screens don't have the same size on various devices, the displayed elements may not have the same sizes from a device to the other one. The Online version is able to print what the browser accepts to print. I just added a @media print CSS query to print only the plan and the 3D view, but only Safari seems to generate a correct page, other browsers giving more or less nice results. If you want to print at a given scale with a more predictable result, you should print with installer version.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
Joined: Jan 13, 2016
Post Count: 21
Status:
Offline
Re: Sweet Home 3D JS Online
The problem is not with printing, but with saving as an image:
function DownloadAsImage() { let downloadLink = document.createElement('a'); downloadLink.setAttribute('download', 'plan.jpg'); let canvas = document.getElementById('home-plan.canvas');
var planView = application.homeControllers[0].planController.planView; var oldGridColor = planView.gridColor; planView.gridColor = "white"; planView.repaint();
France
Joined: Nov 7, 2005
Post Count: 9388
Status:
Offline
Re: Sweet Home 3D JS Online
But... this is not a function provided with Sweet Home 3D JS Online! You should probably create a different plan view at the dimensions you prefer, but I don't know if it will work if that view is not displayed.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
France
Joined: Nov 7, 2005
Post Count: 9388
Status:
Offline
Re: Sweet Home 3D JS Online
I never posted the code you cited in your message, but maybe the following JavaScript code that I tried in the console to save current plan view in an image will be helpful:
PS: please create different threads for this kind of support requests. This thread is for general information about Sweet Home 3D JS Online.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
France
Joined: Nov 7, 2005
Post Count: 9388
Status:
Offline
Re: Sweet Home 3D JS Online
Great you found out, but your solution modifies some attributes of the existing canvas and planView without resetting their values once done. This may have some visible effects on screen…
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer