ITT Rule IDL Version 7.0 Manuel d'utilisateur Page 217

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 430
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 216
Chapter 8: Creating a Manipulator 217
iTool Developer’s Guide Creating a New Manipulator
If the manipulator supports undo/redo functionality, call RecordUndoValues prior to
modifying the visualization in response to scroll wheel actions, and call
CommitUndoValues prior to exiting the method. See “Manipulators and the
Undo/Redo System on page 202 for details.
The parameters of the OnWheel method return information about the location of the
mouse pointer when the scroll wheel is scrolled (
X and Y), information about the
direction and distance the wheel is scrolled (
Delta), and information on any
modifier keys the user held down while scrolling (
Modifiers). See
“IDLitManipulator::OnWheel” (IDL Reference Guide) for details.
Example OnWheel Method
The following example shows an OnWheel method that changes the zoom value of
the current window. (Note that this behavior is the default when the Zoom
manipulator is selected.)
PRO ExampleManip::OnWheel, oWin, X, Y, Delta, Modifiers
; Get the object reference to the current iTool.
oTool = self->GetTool()
IF (~OBJ_VALID(oTool)) THEN RETURN
; Get the object reference to the current view.
oWin = oTool->GetCurrentWindow()
oScene = OBJ_VALID(oWin) ? oWin->GetScene() : OBJ_NEW()
oView = OBJ_VALID(oScene) ? oScene->GetCurrentView() : OBJ_NEW()
IF (~OBJ_VALID(oView)) THEN RETURN
; Retrieve previous zoom factor.
oView->GetProperty, CURRENT_ZOOM=zoom
; Increase or decrease the current zoom by a factor of
; 1.25, depending on which direction the scroll wheel was
; scrolled.
zoomFactor = (delta GT 0) ? 1.25d : 1/1.25d
zoom *= zoomFactor
; Perform the ViewZoom operation.
zoom = STRTRIM(zoom*100, 2) + '%'
void = oTool->DoAction('TOOLBAR/VIEW/VIEWZOOM', OPTION=zoom)
END
Discussion
This OnWheel method simply increases or decreases the View Zoom when the
mouse wheel is scrolled. The zoom is modified by the same factor (1.25) whenever a
Vue de la page 216
1 2 ... 212 213 214 215 216 217 218 219 220 221 222 ... 429 430

Commentaires sur ces manuels

Pas de commentaire