Skip to content

Commit a76b81e

Browse files
refactor(Watermark): update background size check logic (#5137)
Co-Authored-By: Alex chow <[email protected]> Co-Authored-By: Argo Zhang <[email protected]>
1 parent 6980608 commit a76b81e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/BootstrapBlazor/Components/Watermark/Watermark.razor.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const createWatermark = watermark => {
8484
const div = document.createElement('div');
8585
const { base64, styleSize } = bg;
8686
div.style.backgroundImage = `url(${base64})`;
87-
div.style.backgroundSize = `${styleSize.toFixed(3)}px ${styleSize.toFixed(3)}px`;
87+
div.style.backgroundSize = `${styleSize.toFixed(2)}px ${styleSize.toFixed(2)}px`;
8888
div.style.backgroundRepeat = 'repeat';
8989
div.style.pointerEvents = 'none';
9090
div.style.opacity = '1';
@@ -158,7 +158,9 @@ const monitor = watermark => {
158158
clearWatermark(watermark);
159159
return;
160160
}
161-
if (backgroundSize !== `${options.bg.styleSize.toFixed(3)}px ${options.bg.styleSize.toFixed(3)}px`) {
161+
162+
const size = parseFloat(backgroundSize);
163+
if (Math.abs(size - options.bg.styleSize) > 1) {
162164
clearWatermark(watermark);
163165
return;
164166
}

0 commit comments

Comments
 (0)