| 59 | //----------------------------------------------------------------------------- |
| 60 | |
| 61 | void 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 |
nothing calls this directly
no test coverage detected