MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / onMouseDown

Method onMouseDown

Engine/modules/Verve/GUI/VTimeLineControl.cpp:61–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59//-----------------------------------------------------------------------------
60
61void VTimeLineControl::onMouseDown( const GuiEvent &pEvent )
62{
63 Parent::onMouseDown( pEvent );
64
65 if ( !mIsController || !mController || mController->isPlaying() )
66 {
67 return;
68 }
69
70 if ( !isMouseLocked() )
71 {
72 GuiCanvas *canvas = getRoot();
73 if ( canvas->getMouseLockedControl() )
74 {
75 GuiEvent event;
76 canvas->getMouseLockedControl()->onMouseLeave( event );
77 canvas->mouseUnlock( canvas->getMouseLockedControl() );
78 }
79
80 // Lock.
81 mouseLock();
82 }
83
84 // Calculate Time.
85 const Point2I hitPoint = globalToLocalCoord( pEvent.mousePoint );
86 const S32 time = mClamp( toTime( hitPoint.x ), 0, mController->getDuration() );
87
88 // Selection?
89 if ( pEvent.modifier & SI_SHIFT )
90 {
91 if ( !mSelection.Active )
92 {
93 // Selection Active.
94 mSelection.Active = true;
95 mSelection.StartTime = mController->getTime();
96 mSelection.EndTime = time;
97 }
98 else
99 {
100 // Update Selection.
101 mSelection.EndTime = time;
102 }
103
104 // Callback.
105 Con::executef( this, "onSelectionUpdate" );
106 }
107 else
108 {
109 if ( mSelection.Active )
110 {
111 // Selection Invalid.
112 mSelection.Active = false;
113
114 // Callback.
115 Con::executef( this, "onSelectionUpdate" );
116 }
117 }
118

Callers

nothing calls this directly

Calls 10

mClampFunction · 0.85
executefFunction · 0.85
getMouseLockedControlMethod · 0.80
isPlayingMethod · 0.45
onMouseLeaveMethod · 0.45
mouseUnlockMethod · 0.45
getDurationMethod · 0.45
getTimeMethod · 0.45
setTimeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected