Closed sdsoldi closed 5 months ago
Is event.detail.position.x the real click coordinates?
This is scene coordinate, i.e. Three.js objects coordinate space. It can be converted to DXF model space by adding scene origin, which can be obtained by viewer.GetOrigin()
method.
Using viewer.GetOrigin() response is always
{
"x": 0,
"y": 0
}
I think I need the coordinates of the scene because I need to get the nearest mesh or line segments to select and hide if action required
Origin at [0;0] might happen if your DXF has some point at this position and is selected as origin. It may differ with other files. It will be quite difficult to determine DXF primitive from Three.js scene object since they are compiled rendering batches. In general, this feature was not really designed in current viewer version. There are plans to support such use cases in a future version, but currently the development is a bit stuck due to my busyness, so you will probably need a deep modification of the library to implement it. Some additional info can be found in this issue.
I need to get the mouse click positions to find and select nearlest object. Searching in google threejs clientX and clientY are only in mouse (click, mousedown, mouseup) events.
My event has not clientX but has a
Is event.detail.position.x the real click coordinates?