EventListener
아래는 기존 javascript 관련하여 처리하는 방식이고 이 부분도 angular에서 정상작동한다.
그러나 좀더 angular적인 방식을 원한다면 이곳 을 보시기 바랍니다.
Mouse관련 이벤트 리스너
window.addEventListener('resize', this.handleWindowResize.bind(this), false);
document.addEventListener('mousedown', this.handleMouseDown.bind(this), false);
document.addEventListener("touchend", this.handleMouseDown.bind(this), false);
// 특정 element에 대한 eventListener
(document as any).getElementById('forward').addEventListener("click", () => this.move('forward'));
// 윈도우 resize시 renderer와 camera를 변경한다.
private handleWindowResize() {
this.HEIGHT = window.innerHeight;
this.WIDTH = window.innerWidth;
this.renderer.setSize(this.WIDTH, this.HEIGHT);
this.camera.aspect = this.WIDTH / this.HEIGHT;
this.camera.updateProjectionMatrix();
}
// 마우스 다운
private handleMouseDown(event:any) {
}