| 196 | } |
| 197 | |
| 198 | void VTimeLineControl::onRightMouseDown( const GuiEvent &pEvent ) |
| 199 | { |
| 200 | Parent::onRightMouseDown( pEvent ); |
| 201 | |
| 202 | if ( !mIsController || !mController || mController->isPlaying() ) |
| 203 | { |
| 204 | return; |
| 205 | } |
| 206 | |
| 207 | // Calculate Time. |
| 208 | const Point2I hitPoint = globalToLocalCoord( pEvent.mousePoint ); |
| 209 | const S32 time = mClamp( toTime( hitPoint.x ), 0, mController->getDuration() ); |
| 210 | |
| 211 | // Set First Responder. |
| 212 | setFirstResponder(); |
| 213 | |
| 214 | if ( mSelection.Active ) |
| 215 | { |
| 216 | const S32 minTime = getMin( mSelection.StartTime, mSelection.EndTime ); |
| 217 | const S32 maxTime = getMax( mSelection.StartTime, mSelection.EndTime ); |
| 218 | if ( time >= minTime && time <= maxTime ) |
| 219 | { |
| 220 | // Callback. |
| 221 | onMouseEvent( "onSelectionRightClick", pEvent ); |
| 222 | |
| 223 | // Don't Update Time. |
| 224 | return; |
| 225 | } |
| 226 | else |
| 227 | { |
| 228 | if ( mSelection.Active ) |
| 229 | { |
| 230 | // Selection Invalid. |
| 231 | mSelection.Active = false; |
| 232 | |
| 233 | // Callback. |
| 234 | Con::executef( this, "onSelectionUpdate" ); |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | // Reset. |
| 240 | mController->reset( time ); |
| 241 | } |
| 242 | |
| 243 | void VTimeLineControl::onMouseEvent( const char *pEventName, const GuiEvent &pEvent ) |
| 244 | { |