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

Method onMouseDown

Engine/source/Verve/GUI/VTimeLineControl.cpp:62–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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