Skip to content

Commit

Permalink
refactor(Watermark): update background size check logic (#5137)
Browse files Browse the repository at this point in the history
Co-Authored-By: Alex chow <[email protected]>
Co-Authored-By: Argo Zhang <[email protected]>
  • Loading branch information
ArgoZhang and densen2014 authored Jan 17, 2025
1 parent 6980608 commit a76b81e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/BootstrapBlazor/Components/Watermark/Watermark.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const createWatermark = watermark => {
const div = document.createElement('div');
const { base64, styleSize } = bg;
div.style.backgroundImage = `url(${base64})`;
div.style.backgroundSize = `${styleSize.toFixed(3)}px ${styleSize.toFixed(3)}px`;
div.style.backgroundSize = `${styleSize.toFixed(2)}px ${styleSize.toFixed(2)}px`;
div.style.backgroundRepeat = 'repeat';
div.style.pointerEvents = 'none';
div.style.opacity = '1';
Expand Down Expand Up @@ -158,7 +158,9 @@ const monitor = watermark => {
clearWatermark(watermark);
return;
}
if (backgroundSize !== `${options.bg.styleSize.toFixed(3)}px ${options.bg.styleSize.toFixed(3)}px`) {

const size = parseFloat(backgroundSize);
if (Math.abs(size - options.bg.styleSize) > 1) {
clearWatermark(watermark);
return;
}
Expand Down

0 comments on commit a76b81e

Please sign in to comment.