Skip to content

Commit

Permalink
Introduced a tolerance to trigger preview reload
Browse files Browse the repository at this point in the history
  • Loading branch information
car031 committed Nov 30, 2023
1 parent b5f9dee commit 135d29f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,19 @@ protected void doResize() {
media = null;
mail = null;
reload = null;
} else if (!redrawing && (width != getWidth() || height != getHeight())) {
// } else if (!redrawing && (width != getWidth() || height != getHeight())) {
} else if (!redrawing && (!isWithinTolerance(width, getWidth(),10) || !isWithinTolerance(height, getHeight(),10))) {
width = getWidth();
height = getHeight();
clearContent();
showReloadPanel();
}
}

private boolean isWithinTolerance(int value, int targetValue, int tolerance) {
return value >= targetValue - tolerance && value <= targetValue + tolerance;
}

@Override
public synchronized void redraw() {
redrawing = true;
Expand Down

0 comments on commit 135d29f

Please sign in to comment.