| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Graphics.Gloss.Data.ViewState
- data Command
- type CommandConfig = [(Command, [(Key, Maybe Modifiers)])]
- defaultCommandConfig :: CommandConfig
- data ViewState = ViewState {
- viewStateCommands :: !(Map Command [(Key, Maybe Modifiers)])
- viewStateScaleStep :: !Float
- viewStateRotateFactor :: !Float
- viewStateTranslateMark :: !(Maybe (Float, Float))
- viewStateRotateMark :: !(Maybe (Float, Float))
- viewStateViewPort :: ViewPort
- data ViewPort = ViewPort {
- viewPortTranslate :: !(Float, Float)
- viewPortRotate :: !Float
- viewPortScale :: !Float
- viewStateInit :: ViewState
- viewStateInitWithConfig :: CommandConfig -> ViewState
- updateViewStateWithEvent :: Event -> ViewState -> ViewState
- updateViewStateWithEventMaybe :: Event -> ViewState -> Maybe ViewState
- applyViewPortToPicture :: ViewPort -> Picture -> Picture
- invertViewPort :: ViewPort -> Point -> Point
Documentation
The commands suported by the view controller.
defaultCommandConfig :: CommandConfig Source
The default commands. Left click pans, wheel zooms, right click rotates, "r" key resets.
State for controlling the viewport. These are used by the viewport control component.
Constructors
| ViewState | |
Fields
| |
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
| |
viewStateInit :: ViewState Source
The initial view state.
viewStateInitWithConfig :: CommandConfig -> ViewState Source
Initial view state, with user defined config.
updateViewStateWithEventMaybe :: Event -> ViewState -> Maybe ViewState Source
Like updateViewStateWithEvent, but returns Nothing if no update
was needed.
applyViewPortToPicture :: ViewPort -> Picture -> Picture Source
Translates, rotates, and scales an image according to the ViewPort.
invertViewPort :: ViewPort -> Point -> Point Source
Takes a point using screen coordinates, and uses the ViewPort to convert
it to Picture coordinates. This is the inverse of applyViewPortToPicture
for points.