react-three-renderer icon indicating copy to clipboard operation
react-three-renderer copied to clipboard

when i update arrowHelper's length Using MouseMoveListener,the broswer break down?

Open Crise420WMT opened this issue 8 years ago • 3 comments

handledownArrow(ev, color) { this.downArrowX = ev.clientX - this._width / 2; this.downArrowY = -(ev.clientY - this._height / 2 - 20); const origin = new THREE.Vector3(0, 0, 0); const dir = new THREE.Vector3(this.downArrowX, this.downArrowY, 1); dir.normalize();

this._arrow = new THREE.ArrowHelper(dir, origin, 1, color);
this._arrow.position.set(this.downArrowX, this.downArrowY, 0);
// this._arrow.setColor (hex);

this._sceneCanvas.add(this._arrow);

} handlemoveArrow(ev) { const clientX = ev.clientX - this._width / 2; const clientY = -(ev.clientY - this._height / 2 - 20);

this._arrow.setDirection(new THREE.Vector3(clientX, clientY, 1).normalize());
const length = Math.sqrt(Math.pow(clientX - this.downArrowX, 2) + Math.pow(clientY - this.downArrowY, 2));
this._arrow.setLength(length);  // headLength, headWidth
this._rendererCanvas.render(this._sceneCanvas, this._cameraCanvas);

}

Crise420WMT avatar Jan 18 '17 06:01 Crise420WMT

Could you provide a more detailed description of what the problem is?

sehcheese avatar Jan 19 '17 05:01 sehcheese

i can't create a second arrow on scene when i mousedown and mousemove again,and then the broswer broken down.......after debugger,i find it's properly be the this._rendererCanvas.render(this._sceneCanvas, this._cameraCanvas) problem,it catched endless-loop by the way, this.renderer is canvasRenderer.

Crise420WMT avatar Jan 22 '17 09:01 Crise420WMT

Can you please link to a complete example that we can run? I looked at the code you provided but will need to see the whole thing to be able to understand it better.

On Sun, 22 Jan 2017, 09:21 Crise420WMT, [email protected] wrote:

i can't create a second arrow on scene when i mousedown and mousemove again,and then the broswer broken down.......after debugger,i find it's properly be the this._rendererCanvas.render(this._sceneCanvas, this._cameraCanvas) problem,it catched endless-loop

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/toxicFork/react-three-renderer/issues/142#issuecomment-274319359, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0iLTOw26qoM-ZubVFDV0StAIdttCBHks5rUx-LgaJpZM4Lmika .

toxicFork avatar Jan 24 '17 08:01 toxicFork