Class ZoomContent
Wrapper to zoom and pan content by changing the rendering scale so not affecting quality, this is not a transform.
DEBUG INSTRUCTIONS:
- Key debug outputs are enabled for pan movements and clamp operations
- Call DumpDebugState() manually to get a full state dump
- Uncomment debug sections in DrawViews, MeasureContent, ComputeContentScale for frame-by-frame debugging
- Watch for [ClampOffsetImage] CLAMPED! messages to see when pan limits are hit
- The DebugSummary provides comprehensive state when hitting pan limits
public class ZoomContent : ContentLayout, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, IHasAfterEffects, ISkiaDisposable, ISkiaGridLayout, ISkiaLayout, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ILayoutInsideViewport, IInsideViewport, IDisposable, IVisibilityAware, IWithContent, ISkiaGestureListener
- Inheritance
-
ZoomContent
- Implements
- Inherited Members
- Extension Methods
Constructors
ZoomContent()
public ZoomContent()
Fields
ContentScaledRect
protected SKRect ContentScaledRect
Field Value
InvertPanProperty
public static readonly BindableProperty InvertPanProperty
Field Value
LastValue
Last ViewportZoom value we are animating from
protected double LastValue
Field Value
OffsetImage
Pan offset in screen/pixel coordinates
protected SKPoint OffsetImage
Field Value
PanSpeedProperty
public static readonly BindableProperty PanSpeedProperty
Field Value
PanningModeProperty
public static readonly BindableProperty PanningModeProperty
Field Value
Value
protected double Value
Field Value
ViewportZoomProperty
public static readonly BindableProperty ViewportZoomProperty
Field Value
ZoomLockedProperty
public static readonly BindableProperty ZoomLockedProperty
Field Value
ZoomMaxProperty
public static readonly BindableProperty ZoomMaxProperty
Field Value
ZoomMinProperty
public static readonly BindableProperty ZoomMinProperty
Field Value
ZoomSpeedProperty
public static readonly BindableProperty ZoomSpeedProperty
Field Value
_animatorValue
protected RangeAnimator _animatorValue
Field Value
_panStarted
protected PointF _panStarted
Field Value
Properties
InvertPan
When false (default), panning centers the zoom on the finger position (finger "sticks" to content). When true, panning moves the content like a scroll view (content moves in same direction as finger).
public bool InvertPan { get; set; }
Property Value
PanSpeed
public double PanSpeed { get; set; }
Property Value
PanningMode
public PanningModeType PanningMode { get; set; }
Property Value
ViewportZoom
public double ViewportZoom { get; set; }
Property Value
ZoomLocked
public bool ZoomLocked { get; set; }
Property Value
ZoomMax
public double ZoomMax { get; set; }
Property Value
ZoomMin
public double ZoomMin { get; set; }
Property Value
ZoomSpeed
How much of finger movement will affect zoom change
public double ZoomSpeed { get; set; }
Property Value
Methods
ComputeContentScale(SKRect, float, SKPoint)
Computes the scaled destination rectangle and scale for content rendering. OffsetImage is expected to be in screen/pixel coordinates relative to the viewport.
public (SKRect ScaledDestination, float Scale) ComputeContentScale(SKRect destination, float scale, SKPoint offsetPixels)
Parameters
Returns
DrawViews(DrawingContext)
Base method will call RenderViewsList. Return number of drawn views.
protected override int DrawViews(DrawingContext context)
Parameters
contextDrawingContext
Returns
InitializeAnimator()
protected void InitializeAnimator()
OnBindingContextChanged()
First Maui will apply bindings to your controls, then it would call OnBindingContextChanged, so beware on not to break bindings.
protected override void OnBindingContextChanged()
ProcessGestures(SkiaGesturesParameters, GestureEventProcessingInfo)
public override ISkiaGestureListener ProcessGestures(SkiaGesturesParameters args, GestureEventProcessingInfo apply)
Parameters
argsSkiaGesturesParametersapplyGestureEventProcessingInfo
Returns
Reset()
public void Reset()
ScalePixels(float)
protected float ScalePixels(float value)
Parameters
valuefloat
Returns
ScalePoints(double)
protected float ScalePoints(double value)
Parameters
valuedouble
Returns
SetZoom(double, bool)
public void SetZoom(double zoom, bool animate)