|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: Export HTML5 plug-in |
||
| Print at Dec 16, 2025, 6:07:40 PM |
|
|
| Posted by boe666 at Dec 11, 2018, 2:35:58 PM |
|
Re: Export HTML5 plug-in Can I check this getClosestItemAt method ? Where is object's coordinates ? If I write x an y direct in code - this method still return null. I take x y coordinates from js console after selected object by code. i.e.: selecting object: and I take x y from itemSel[0].x and itemSel[0].y I write this to my listener (from now always return this coordinates), and still i have null after use getClosestItemAt(x,y). I thought i have to translate x,y from mouse, to have always the same coordinates, independed from actual view of camera, coresponding with object's x and y. |
| Posted by boe666 at Dec 11, 2018, 3:00:19 PM |
|
Re: Export HTML5 plug-in Or maybe this is the problem. Shown after click on canvas. |
| Posted by Puybaret at Dec 11, 2018, 4:00:59 PM |
|
Re: Export HTML5 plug-in The problem is that you read too quickly the setSelectedItems jsdoc ![]() ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by boe666 at Dec 11, 2018, 5:13:27 PM |
|
Re: Export HTML5 plug-in I don't understand. First of all I read all furnitures to table (FURNITURES[]). After this i print the links to select every funriture ( from this table). After click i do this: every furniture has his own x and y coordinates. In console I have all object (with many data) in room (every furniture) after console.log(FURNITURES); This is not problem with to fast reading. How can I read proper x and y for one furniture ? (to check getClosestItemsAt) |
| Posted by boe666 at Dec 12, 2018, 8:17:16 AM |
|
Re: Export HTML5 plug-in Maybe my questions are stupid and for many of You - "groundless", but I realy want understand structure of sweethome3d (in HTML5). Most (in my opinion - almost all) posts on this forum concerns on java version and problems with aplication ( directly on "painting" models). Can you show me the way to do this ? For example - if I confirm what x,y coordinates work with getClosestItemsAt, I will find the way how to calculate x,y depend of actual camera view. I want to eliminate errors before I started, I want to be sure I'm not making a simple mistake. |
| Posted by Puybaret at Dec 12, 2018, 6:16:00 PM |
|
Re: Export HTML5 plug-in Your questions are not stupid, but most contributors in the forum are Sweet Home 3D users, not programmers (and even less JavaScript programmers). If you want to understand how to use Sweet Home 3D JS, learn how to use the debugger in your browser, this will help you in many cases. By the way, getClosestItemsAt method takes in parameter 2D coordinates, so translating to canvas space just consist of substracting rect.x and rect.y from e.clientX and e.clientY. Measuring pixel locations at screen with your mouse pointer would have given you the solution... ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by boe666 at Dec 12, 2018, 7:43:57 PM |
|
Re: Export HTML5 plug-in Before I ask and write more question - i checked this - it's not working. I thought i have to recalculate x,y from plain rec to virtual canvas (2d to 3d coordinates - x,y only of course). I was ready to check every x,y combination to check proper work getClosestItemsAt function. I change my code, this part: console after loading: Error: WebGL warning: drawArrays: Drawing to a destination rect smaller than the viewport rect. (This warning will only be given once) viewmodel.min.js:20:53017console after click on canvas: make this errors problem? code is ok ? http://smarted.pl/sh3d/viewHome.html# |
| Posted by boe666 at Dec 15, 2018, 3:28:29 PM |
|
Re: Export HTML5 plug-in somebody can can check the code ? Now it's ok ? If ok, why it not working ? Maybe the errors are the problem ? Ho to eliminate this errors ? |
| Posted by boe666 at Dec 18, 2018, 9:48:14 AM |
|
Re: Export HTML5 plug-in Somebody ???? |
| Posted by boe666 at Jan 3, 2019, 2:07:31 PM |
|
Re: Export HTML5 plug-in Maybe, in first days of new year, somebody show my indolence.. I realy don't know why .getClosestItemAt(x, y) doesn't work.... |
|
|
|
Current timezone is GMT Dec 16, 2025, 6:07:40 PM |