Open wisoo opened 5 years ago
At the current version (0.0.6 beta - 8/8/2022), the above fix no longer works.
this.getCanvasPosFromEvent(e, this.mousePos)
is modified this.mousePos
and then return that exact value => so the new var canvasMousePos
will be the same as this.mousePos
.
The problem here is in CameraControl.getCanvasPosFromEvent()
, we're using event.pageX
and event.pageY
subtract the offset from event.target.getBoundingClientRect()
to get the click position on the canvas.
-> But getBoundingClientRect
is provides the information of the canvas related to the viewport, not to the page
-> My fix is to change any pageX
to clientX
and pageY
to clientY
in that getCanvasPosFromEvent
method.
Thanks ^^
Hello Rubendel,
I noticed a problem in cameracontrol.js i've been using bimsurfer, i inserted the canvas in a custom webpage when scrolling the scroll offset was not taken into account so i had to click above or below the objects to be able to select them.
a quick fix to this is using your
getCanvasPosFromEvent()
function before executingpick()
this.getCanvasPosFromEvent(e, this.mousePos);canvasPos: this.mousePos,Hope this helps keep up the good work !