Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
fix: tap area error
Browse files Browse the repository at this point in the history
  • Loading branch information
EYHN committed Mar 31, 2019
1 parent fe17c5a commit d929f60
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cLive2DApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function theRealInit (){
initEvent();

dragMgr = new L2DTargetPoint();
let ratio = currCanvas.height / currCanvas.width;
let rect = currCanvas.getBoundingClientRect();
let ratio = rect.height / rect.width;
let left = cDefine.VIEW_LOGICAL_LEFT;
let right = cDefine.VIEW_LOGICAL_RIGHT;
let bottom = -ratio;
Expand All @@ -68,11 +69,11 @@ function theRealInit (){
cDefine.VIEW_LOGICAL_MAX_TOP);

projMatrix = new L2DMatrix44();
projMatrix.multScale(1, (currCanvas.width / currCanvas.height));
projMatrix.multScale(1, (rect.width / rect.height));

deviceToScreen = new L2DMatrix44();
deviceToScreen.multTranslate(-currCanvas.width / 2.0, -currCanvas.height / 2.0); // #32
deviceToScreen.multScale(2 / currCanvas.width, -2 / currCanvas.height); // #32
deviceToScreen.multTranslate(-rect.width / 2.0, -rect.height / 2.0); // #32
deviceToScreen.multScale(2 / rect.width, -2 / rect.height); // #32


Live2D.setGL(currWebGL);
Expand Down

0 comments on commit d929f60

Please sign in to comment.