Skip to content

Commit

Permalink
feat(Comparisons): finetune indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
domtra committed Sep 27, 2024
1 parent bd92c85 commit d2fce61
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions components/comparisons/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,17 @@ class VrtsComparisons extends window.HTMLElement {

highlightPixels( pixels ) {
const ctx = this.$diffIndicator.getContext( '2d' );
ctx.clearRect( 0, 0, ctx.canvas.width, ctx.canvas.height );
ctx.fillStyle = 'rgba(255, 0, 0, 0.5)';
this.$diffIndicator.width = this.$comparison.naturalWidth;
this.$diffIndicator.height = this.$comparison.naturalHeight;
ctx.clearRect(
0,
0,
this.$comparison.naturalWidth,
this.$comparison.naturalHeight
);
ctx.fillStyle = 'red';
pixels.forEach( ( y ) => {
ctx.fillRect(
0,
( y * ctx.canvas.height ) / this.$comparison.naturalHeight - 2,
ctx.canvas.width,
3
);
ctx.fillRect( 0, y, ctx.canvas.width, 1 );
} );
}

Expand Down

0 comments on commit d2fce61

Please sign in to comment.