728x90
반응형
let rect = this.canvas.getBoundingClientRect();
let scaleX = this.canvas.width/rect.width;
let scaleY = this.canvas.height/rect.height;
//resize된 캔버스 마우스 pos 재정렬
this.mousePos.x = (e.clientX - rect.left)*scaleX
this.mousePos.y = (e.clientY - rect.top)*scaleY
728x90
반응형
'자바스크립트 > Javascript' 카테고리의 다른 글
canvas의 scale에 원리! (0) | 2021.03.18 |
---|---|
XMLHttpRequest를 통해 canvas의 그린 이미지를 서버에 던지기 (0) | 2021.02.26 |
What is Webpack? 웹팩이란 무엇일까? (0) | 2021.01.31 |
javasciript closure(클로저)란?? (0) | 2021.01.07 |
explorer11 javascript replace를 replaceall 처럼 활용하기 (1) | 2021.01.03 |
댓글