gloss-1.8.1.2: Painless 2D vector graphics, animations and simulations.

Safe HaskellNone

Graphics.Gloss.Data.ViewState

Synopsis

Documentation

data Command Source

The commands suported by the view controller.

defaultCommandConfig :: CommandConfigSource

The default commands. Left click pans, wheel zooms, right click rotates, r key resets.

data ViewState Source

State for controlling the viewport. These are used by the viewport control component.

Constructors

ViewState 

Fields

viewStateCommands :: !(Map Command [(Key, Maybe Modifiers)])

The command list for the viewport controller. These can be safely overwridden at any time by deleting or adding entries to the list. Entries at the front of the list take precedence.

viewStateScaleStep :: !Float

How much to scale the world by for each step of the mouse wheel.

viewStateRotateFactor :: !Float

How many degrees to rotate the world by for each pixel of x motion.

viewStateTranslateMark :: !(Maybe (Float, Float))

During viewport translation, where the mouse was clicked on the window.

viewStateRotateMark :: !(Maybe (Float, Float))

During viewport rotation, where the mouse was clicked on the window

viewStateViewPort :: ViewPort
 

data ViewPort Source

The ViewPort represents the global transformation applied to the displayed picture. When the user pans, zooms, or rotates the display then this changes the ViewPort.

Constructors

ViewPort 

Fields

viewPortTranslate :: !(Float, Float)

Global translation.

viewPortRotate :: !Float

Global rotation (in degrees).

viewPortScale :: !Float

Global scaling (of both x and y coordinates).

viewStateInit :: ViewStateSource

The initial view state.

viewStateInitWithConfig :: CommandConfig -> ViewStateSource

Initial view state, with user defined config.

applyViewPortToPicture :: ViewPort -> Picture -> PictureSource

Translates, rotates, and scales an image according to the ViewPort.

invertViewPort :: ViewPort -> Point -> PointSource

Takes a point using screen coordinates, and uses the ViewPort to convert it to Picture coordinates. This is the inverse of applyViewPortToPicture for points.