|
|
|
|
|
| Description |
| Provides a scalable, scrollable, rotateable viewport that the user
can control with the keyboard / mouse.
|
|
| Synopsis |
|
|
|
| Documentation |
|
| data ViewState |
| Viewport state
| | Constructors | | ViewState | | | stateViewScale :: Float | The world is scaled by this factor in both x and y directions.
| | stateViewTranslate :: (Float, Float) | The world is translated by this vector.
| | stateViewRotate :: Float | The world is rotated by this angle, in degrees.
| | stateViewScaleStep :: Float | How much to scale the world by for each step of the mouse wheel.
| | stateViewRotateFactor :: Float | How many degrees to rotate the world by for each pixel of x motion.
| | stateViewTranslateMark :: (Maybe (Int, Int)) | During viewport translation,
where the mouse was clicked on the window.
| | stateViewRotateMark :: (Maybe (Int, Int)) | During viewport rotation,
where the mouse was clicked on the window
|
|
|
|
|
| viewStateInit :: ViewState |
| The initial view state.
|
|
| withViewCoords |
| :: ViewState | The current state.
| | -> IO () | The action to preform within the world coordinate system.
| | -> IO () | | Perform an action whilst using the world co-ordinate system.
With the default view:
- The origin is at the center of the window.
- Each unit in the x-y plane is worth one pixel in the window.
This view can be modified by the user using the mouse.
|
|
|
| controlView :: IORef ViewState -> [Callback] |
| Callbacks for controlling the viewport with the keyboard / mouse.
also contains the reshape callback needed to keep the viewport setup right
when the window size changes.
|
|
| controlView_motion :: IORef ViewState -> Position -> IO () |
| GLUT calls back on this function when the mouse moves while a key or button
has been pressed. It updates the state to manage translation or rotation of the
world view.
|
|
| controlView_reshape |
| :: IORef ViewState | The current state.
| | -> Size | New window size.
| | -> IO () | | | GLUT calls back on this function when the window size changes.
It configures the new viewport and writes the new size into the state.
|
|
|
| Produced by Haddock version 0.7 |