Skip to content

Commit

Permalink
fix: RaiseRenderedContentUpdated being called twice
Browse files Browse the repository at this point in the history
  • Loading branch information
vatsashah45 committed Oct 22, 2024
1 parent 7703b13 commit bed83ed
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ private void OnAdditionalMarginChanged()

private async void OnZoomLevelChanged()
{
CoerceZoomLevel();
if (CoerceZoomLevel())
{
return;
}

UpdateScrollBars();
UpdateScrollVisibility();
await RaiseRenderedContentUpdated();
Expand Down Expand Up @@ -199,9 +203,17 @@ private void UpdateScrollBars()
}
}

private void CoerceZoomLevel()
private bool CoerceZoomLevel()
{
ZoomLevel = Math.Clamp(ZoomLevel, MinZoomLevel, MaxZoomLevel);
var zoomLevel = ZoomLevel;
var coercedZoomLevel = Math.Clamp(zoomLevel, MinZoomLevel, MaxZoomLevel);
if (coercedZoomLevel != zoomLevel)
{
ZoomLevel = coercedZoomLevel;
return true;
}

return false;
}

private void OnSizeChanged(object sender, SizeChangedEventArgs args)
Expand Down

0 comments on commit bed83ed

Please sign in to comment.