Gorgon
Show / Hide Table of Contents

Class AnchorEditService

A service used to edit an anchor point on a sprite.

Inheritance
object
AnchorEditService
Implements
IAnchorEditService
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Editor.Services
Assembly: Gorgon.Editor.API.dll
Syntax
public class AnchorEditService : IAnchorEditService

Constructors

| Edit this page View Source

AnchorEditService(Gorgon2D, GorgonSprite, Rectangle)

Initializes a new instance of the AnchorEditService class.

Declaration
public AnchorEditService(Gorgon2D renderer, GorgonSprite anchorSprite, Rectangle bounds)
Parameters
Type Name Description
Gorgon2D renderer

The 2D renderer for the application.

GorgonSprite anchorSprite

The sprite representing the anchor icon.

Rectangle bounds

The boundaries for the anchor point.

Properties

| Edit this page View Source

AnchorPosition

Property to set or return the position of the sprite anchor.

Declaration
public Vector2 AnchorPosition { get; set; }
Property Value
Type Description
Vector2
| Edit this page View Source

Camera

Property to set or return the camera for the renderer.

Declaration
public GorgonOrthoCamera Camera { get; set; }
Property Value
Type Description
GorgonOrthoCamera
| Edit this page View Source

CenterPosition

Property to set or return the center position of the sprite.

Declaration
public Vector2 CenterPosition { get; set; }
Property Value
Type Description
Vector2
| Edit this page View Source

IsDragging

Property to return whether we're in the middle of a drag operation or not.

Declaration
public bool IsDragging { get; }
Property Value
Type Description
bool

Methods

| Edit this page View Source

KeyDown(PreviewKeyDownEventArgs)

Function to intercept keyboard key presses.

Declaration
public bool KeyDown(PreviewKeyDownEventArgs e)
Parameters
Type Name Description
PreviewKeyDownEventArgs e

The event arguments.

Returns
Type Description
bool

true if the event is handled, false if not.

| Edit this page View Source

MouseDown(MouseArgs)

Function called when the mouse button is pressed.

Declaration
public bool MouseDown(MouseArgs args)
Parameters
Type Name Description
MouseArgs args

The mouse event arguments.

Returns
Type Description
bool

true if the mouse event was handled, false if it was not.

| Edit this page View Source

MouseMove(MouseArgs)

Function called when the mouse button is moved.

Declaration
public bool MouseMove(MouseArgs args)
Parameters
Type Name Description
MouseArgs args

The mouse event arguments.

Returns
Type Description
bool

true if the mouse event was handled, false if it was not.

| Edit this page View Source

MouseUp(MouseArgs)

Function called when the mouse button is released.

Declaration
public bool MouseUp(MouseArgs _)
Parameters
Type Name Description
MouseArgs _

Not used.

Returns
Type Description
bool

true if the mouse event was handled, false if it was not.

| Edit this page View Source

Render()

Function to render the anchor UI.

Declaration
public void Render()
| Edit this page View Source

Reset()

Function to reset the anchor value.

Declaration
public void Reset()

Events

| Edit this page View Source

AnchorChanged

Event triggered when the anchor position is updated.

Declaration
public event EventHandler AnchorChanged
Event Type
Type Description
EventHandler

Implements

IAnchorEditService

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • 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