Gorgon
Show / Hide Table of Contents

Class ZoomLevelExtensions

Extension methods for the zoom levels.

Inheritance
object
ZoomLevelExtensions
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Editor.UI
Assembly: Gorgon.Editor.API.dll
Syntax
public static class ZoomLevelExtensions

Methods

| Edit this page View Source

FromName(string)

Function to convert a friendly name to an associated zoom level.

Declaration
public static ZoomLevels FromName(this string name)
Parameters
Type Name Description
string name

The name to look up.

Returns
Type Description
ZoomLevels

The associated zoom level.

| Edit this page View Source

GetName(ZoomLevels)

Function to convert a ZoomLevels to its associated friendly name.

Declaration
public static string GetName(this ZoomLevels zoomLevel)
Parameters
Type Name Description
ZoomLevels zoomLevel

The zoom level to retrieve the name for.

Returns
Type Description
string

The friendly name of the zoom level.

| Edit this page View Source

GetNextNearest(float)

Function to retrieve the nearest previous zoom scale based on the scaling value passed in.

Declaration
public static ZoomLevels GetNextNearest(this float zoomScale)
Parameters
Type Name Description
float zoomScale

The zoom scaling factor to evalute.

Returns
Type Description
ZoomLevels

The nearest previous zoom level.

| Edit this page View Source

GetPrevNearest(float)

Function to retrieve the nearest previous zoom scale based on the scaling value passed in.

Declaration
public static ZoomLevels GetPrevNearest(this float zoomScale)
Parameters
Type Name Description
float zoomScale

The zoom scaling factor to evalute.

Returns
Type Description
ZoomLevels

The nearest previous zoom level.

| Edit this page View Source

GetScale(ZoomLevels)

Function to convert a ZoomLevels to its associated scaling factor.

Declaration
public static float GetScale(this ZoomLevels zoomLevel)
Parameters
Type Name Description
ZoomLevels zoomLevel

The zoom level to retrieve the scaling factor from.

Returns
Type Description
float

The scaling factor.

Remarks

When the zoom level is set to ToWindow, then this method will return -1.

| Edit this page View Source

GetZoomLevel(float)

Function to retrieve the best ZoomLevels for the value passed.

Declaration
public static ZoomLevels GetZoomLevel(this float zoomScale)
Parameters
Type Name Description
float zoomScale

The scale value to evaluate.

Returns
Type Description
ZoomLevels

The zoom level that best matches the scale.

  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author