![]() If you want to use mouse coordinates in another event handler than you need to make some preparation. Intersects = raycaster.intersectObjects(board. When we work on the canvas its easy to find the x and y coordinates of the mouse using the following two properties: var mouseX e.offsetX var mouseY e.offsetY These properties work fine on every browser except Firefox because the offsetX and offsetY event properties are not supported by Firefox. Firefox tracks mouse position only for mouse related events (onmouseover, onmousemove, e.t.c.). How do I ge thte mouse position when in FireFox .If isDrawing is true, the event handler calls the drawLine function to draw a line from the stored x and y values to the current location. This code works in IE but in FireFox the alert just says 0,0. Possible I don’t think it can be done through javascript alone, to get the pointer position at the time of a keypress event for instance. As the mouse moves over the page, the mousemove event fires. Get mouse coordinates from non-mouse events Add-ons quicksaver(Lus Miguel) April 20, 2016, 1:49pm 1 Just as it says in the title. Const intersects = raycaster.intersectObjects(scene.children) įor (let i = 0 i < intersects.length i++) ) įor (let x = 0 x child.name = "Checker") Ĭ( * 0.4, * 0.4, * 0.4) Ĭ += Ĭonst light = new THREE.PointLight(0xffffff, 2, 200) Ĭontrols = new OrbitControls(camera, renderer.domElement) Ĭonst found = ((child) => = square) First we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isDrawing to true.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |