ContentsIndex
Graphics.Plot.View
Description
Provides a scalable, scrollable, rotateable viewport that the user can control with the keyboard / mouse.
Synopsis
data ViewState = ViewState {
stateViewScale :: Float
stateViewTranslate :: (Float, Float)
stateViewRotate :: Float
stateViewScaleStep :: Float
stateViewRotateFactor :: Float
stateViewTranslateMark :: (Maybe (Int, Int))
stateViewRotateMark :: (Maybe (Int, Int))
}
viewStateInit :: ViewState
withViewCoords :: ViewState -> IO () -> IO ()
controlView :: IORef ViewState -> [Callback]
controlView_motion :: IORef ViewState -> Position -> IO ()
controlView_reshape :: IORef ViewState -> Size -> IO ()
Documentation
data ViewState
Viewport state
Constructors
ViewState
stateViewScale :: FloatThe world is scaled by this factor in both x and y directions.
stateViewTranslate :: (Float, Float)The world is translated by this vector.
stateViewRotate :: FloatThe world is rotated by this angle, in degrees.
stateViewScaleStep :: FloatHow much to scale the world by for each step of the mouse wheel.
stateViewRotateFactor :: FloatHow 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
:: ViewStateThe 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 ViewStateThe current state.
-> SizeNew 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