Skip to content

Commit

Permalink
HTMLMesh: Render image at the correct position (#25916)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin authored Apr 24, 2023
1 parent fab4ed4 commit 888ced8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/jsm/interactive/HTMLMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,14 @@ function html2canvas( element ) {

if ( element.style.display === 'none' ) return;

context.drawImage( element, 0, 0, element.width, element.height );
const rect = element.getBoundingClientRect();

x = rect.left - offset.left - 0.5;
y = rect.top - offset.top - 0.5;
width = rect.width + 0.5;
height = rect.height + 0.5;

context.drawImage( element, x, y, width, height );

} else {

Expand Down

0 comments on commit 888ced8

Please sign in to comment.