Fix MinZoom/MaxZoom having no effect on iOS#15
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
… scale - Add _enableZoom, _minZoom, _maxZoom backing fields to PdfViewiOS - Add _needsZoomConstraintsApply deferred flag - Convert EnableZoom getter to use _enableZoom backing field; setter now calls ApplyZoomConstraints() instead of setting MinScaleFactor directly - Convert MinZoom/MaxZoom from auto-properties to backed properties that call ApplyZoomConstraints() on change - Add ApplyZoomConstraints() that sets MinScaleFactor/MaxScaleFactor relative to the current fit scale (MinZoom * fitScale / MaxZoom * fitScale) and defers via _needsZoomConstraintsApply when the document isn't loaded or the view bounds aren't valid yet - ApplyFitPolicy() now sets _needsZoomConstraintsApply = true so constraints are always re-applied after the fit scale changes - LayoutSubviewsAction processes _needsZoomConstraintsApply flag, ensuring constraints are applied once the layout has valid bounds and scale factor Fixes #14
Copilot
AI
changed the title
[WIP] Fix MinZoom property effect on iOS
Fix MinZoom/MaxZoom having no effect on iOS
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MinZoomandMaxZoomwere silently ignored on iOS. WhenFitPolicy.Widthis active, PDFKit'sAutoScales = trueoverridesMinScaleFactor/MaxScaleFactorfor gesture-based zooming, making it impossible to constrain zoom bounds declaratively. Additionally, the oldEnableZoomsetter appliedMinZoom/MaxZoomas raw absolute scale factors rather than relative to the fit scale, so the values were semantically wrong even when they did get applied.Changes
New
ApplyZoomConstraints()method — setsMinScaleFactor = MinZoom × fitScaleandMaxScaleFactor = MaxZoom × fitScaleon the nativePDFView, wherefitScaleis the scale factor computed by the activeFitPolicy. This aligns iOS semantics with Android (where1.0= cannot zoom below fit,3.0= can zoom to 3× fit).Deferred application via
_needsZoomConstraintsApplyflag —ApplyFitPolicy()sets the flag;LayoutSubviewsActionprocesses it once the view has valid bounds and a stableScaleFactor. This handles both the initial load (whereAutoScaleshasn't settled yet) and runtimeFitPolicychanges.EnableZoom,MinZoom,MaxZoomare now reactive — each property stores a backing field and callsApplyZoomConstraints()immediately (or defers if the document isn't loaded yet), so runtime updates propagate to the native layer.The user-space workaround of setting
nativePdfView.MinScaleFactor = nativePdfView.ScaleFactorinOnRenderedis no longer needed.