DiagramViewportMath
StockSharp.Xaml.Diagram.Viewport
Shared viewport calculations used by the editor, toolbar and overview.
Métodos
Center
public static DiagramViewportState Center(Rect contentBounds, Size viewportSize, double scale)
result = DiagramViewportMath.Center(contentBounds, viewportSize, scale)
Centers content at the supplied scale.
- contentBounds
- Diagram-space content bounds.
- viewportSize
- Screen-space viewport size.
- scale
- Viewport scale.
Retorna: Centered viewport transform.
Fit
public static DiagramViewportState Fit(Rect contentBounds, Size viewportSize, double padding)
result = DiagramViewportMath.Fit(contentBounds, viewportSize, padding)
Fits content into a viewport while preserving its aspect ratio.
- contentBounds
- Diagram-space content bounds.
- viewportSize
- Screen-space viewport size.
- padding
- Screen-space padding.
Retorna: Fitted viewport transform.
FromSliderValue
public static double FromSliderValue(double sliderValue)
result = DiagramViewportMath.FromSliderValue(sliderValue)
Converts a base-2 slider value to a viewport scale.
- sliderValue
- Slider value.
Retorna: Viewport scale.
GetScrollRange
public static DiagramScrollRange GetScrollRange(double contentStart, double contentLength, double viewportLength)
result = DiagramViewportMath.GetScrollRange(contentStart, contentLength, viewportLength)
Says where a viewport stands along one axis of the document it shows.
- contentStart
- Screen-space start of the content along the axis.
- contentLength
- Screen-space length of the content along the axis.
- viewportLength
- Length of the viewport along the axis.
Retorna: What a scroll bar along that axis shows.
ToSliderValue
public static double ToSliderValue(double scale)
result = DiagramViewportMath.ToSliderValue(scale)
Converts a scale to the WPF-compatible base-2 slider value.
- scale
- Viewport scale.
Retorna: Slider value in the range -4 through 2.
Campos
MaximumScale
public const double MaximumScale
value = DiagramViewportMath.MaximumScale
Maximum supported diagram scale.
MinimumScale
public const double MinimumScale
value = DiagramViewportMath.MinimumScale
Minimum supported diagram scale.