Skip to content

Commit

Permalink
Fix left positioning in device preview mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlende committed Mar 10, 2020
1 parent 38b4c10 commit af48db6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function useMotionBackground() {

const width = blockRect.width;
const height = blockRect.height;
const left = blockRect.left;
const left = canvasRect.left - blockRect.left;
const bottom = canvasRect.bottom - blockRect.bottom;

renderBlock( block, [ width, height ], [ left, bottom ] );
Expand Down Expand Up @@ -372,7 +372,7 @@ function useMotionBackground() {
*/
function updateMouse( e ) {
const rect = gl.canvas.getBoundingClientRect();
globalState.mouse[ 0 ] = e.clientX;
globalState.mouse[ 0 ] = e.clientX - rect.left;
globalState.mouse[ 1 ] = rect.top + rect.height - e.clientY; // From bottom
}
document.body.addEventListener( 'mousemove', updateMouse );
Expand Down

0 comments on commit af48db6

Please sign in to comment.