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

Method onMouseUp

Engine/source/gui/editor/guiEditCtrl.cpp:403–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401//-----------------------------------------------------------------------------
402
403void GuiEditCtrl::onMouseUp(const GuiEvent &event)
404{
405 if (! mActive || !mContentControl || !getCurrentAddSet() )
406 {
407 Parent::onMouseUp(event);
408 return;
409 }
410
411 //find the control we clicked
412 GuiControl *ctrl = mContentControl->findHitControl(mLastMousePos, getCurrentAddSet()->mLayer);
413
414 bool handledEvent = ctrl->onMouseUpEditor( event, localToGlobalCoord( Point2I(0,0) ) );
415 if( handledEvent == true )
416 {
417 // The Control handled the event and requested the edit ctrl
418 // *NOT* act on it. The dude abides.
419 return;
420 }
421
422 //unlock the mouse
423 mouseUnlock();
424
425 // Reset Drag Axis Alignment Information
426 mDragBeginPoint.set(-1,-1);
427 mDragBeginPoints.clear();
428
429 mLastMousePos = globalToLocalCoord(event.mousePoint);
430 if( mMouseDownMode == DragGuide )
431 {
432 // Check to see if the mouse has moved off the canvas. If so,
433 // remove the guides being dragged.
434
435 for( U32 axis = 0; axis < 2; ++ axis )
436 if( mDragGuide[ axis ] && !getContentControl()->getGlobalBounds().pointInRect( event.mousePoint ) )
437 mGuides[ axis ].erase( mDragGuideIndex[ axis ] );
438 }
439 else if( mMouseDownMode == DragSelecting )
440 {
441 // If not multiselecting, clear the current selection.
442
443 if( !( event.modifier & SI_MULTISELECT ) && !mDragAddSelection )
444 clearSelection();
445
446 RectI rect;
447 getDragRect( rect );
448
449 // If the region is somewhere less than at least 2x2, count this as a
450 // normal, non-rectangular selection.
451
452 if( rect.extent.x <= 2 && rect.extent.y <= 2 )
453 addSelectControlAt( rect.point );
454 else
455 {
456 // Use HIT_AddParentHits by default except if ALT is pressed.
457 // Use HIT_ParentPreventsChildHit if ALT+CTRL is pressed.
458
459 U32 hitFlags = 0;
460 if( !( event.modifier & SI_PRIMARY_ALT ) )

Callers

nothing calls this directly

Calls 9

getContentControlFunction · 0.85
getSelectedSetFunction · 0.85
onMouseUpEditorMethod · 0.80
pointInRectMethod · 0.80
Point2IClass · 0.50
findHitControlMethod · 0.45
setMethod · 0.45
clearMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected