本文整理汇总了C++中FPointerEvent::GetEffectingButton方法的典型用法代码示例。如果您正苦于以下问题:C++ FPointerEvent::GetEffectingButton方法的具体用法?C++ FPointerEvent::GetEffectingButton怎么用?C++ FPointerEvent::GetEffectingButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPointerEvent
的用法示例。
在下文中一共展示了FPointerEvent::GetEffectingButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseButtonDown
FReply SPaperEditorViewport::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
TotalMouseDelta = 0;
if (MouseEvent.GetEffectingButton() == EKeys::RightMouseButton)
{
// RIGHT BUTTON is for dragging and Context Menu.
FReply ReplyState = FReply::Handled();
ReplyState.CaptureMouse( SharedThis(this) );
ReplyState.UseHighPrecisionMouseMovement( SharedThis(this) );
SoftwareCursorPosition = PanelCoordToGraphCoord( MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() ) );
// clear any interpolation when you manually pan
//DeferredMovementTargetObject = nullptr;
return ReplyState;
}
else if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
{
// START MARQUEE SELECTION.
const FVector2D GraphMousePos = PanelCoordToGraphCoord( MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() ) );
Marquee.Start( GraphMousePos, FMarqueeOperation::OperationTypeFromMouseEvent(MouseEvent) );
// Trigger a selection update now so that single-clicks without a drag still select something
OnSelectionChanged.ExecuteIfBound(Marquee, true);
PaperViewportClient->Invalidate();
return FReply::Handled().CaptureMouse( SharedThis(this) );
}
else
{
return FReply::Unhandled();
}
}
示例2: OnMouseButtonDoubleClick
FReply FSceneViewport::OnMouseButtonDoubleClick( const FGeometry& InGeometry, const FPointerEvent& InMouseEvent )
{
// Start a new reply state
CurrentReplyState = FReply::Handled();
// Note: When double-clicking, the following message sequence is sent:
// WM_*BUTTONDOWN
// WM_*BUTTONUP
// WM_*BUTTONDBLCLK (Needs to set the KeyStates[*] to true)
// WM_*BUTTONUP
KeyStateMap.Add( InMouseEvent.GetEffectingButton(), true );
UpdateCachedMousePos( InGeometry, InMouseEvent );
UpdateCachedGeometry(InGeometry);
if( ViewportClient && GetSizeXY() != FIntPoint::ZeroValue )
{
// Switch to the viewport clients world before processing input
FScopedConditionalWorldSwitcher WorldSwitcher( ViewportClient );
if( !ViewportClient->InputKey( this, 0, InMouseEvent.GetEffectingButton(), IE_DoubleClick ) )
{
CurrentReplyState = FReply::Unhandled();
}
}
return CurrentReplyState;
}
示例3: OnMouseButtonDown
FReply SColorGradientEditor::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if( IsEditingEnabled.Get() == true )
{
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
// Select the stop under the mouse if any and capture the mouse to get detect dragging
SelectedStop = GetGradientStopAtPoint( MouseEvent.GetScreenSpacePosition(), MyGeometry );
return FReply::Handled().CaptureMouse( SharedThis(this) );
}
else if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
FGradientStopMark PossibleSelectedStop = GetGradientStopAtPoint( MouseEvent.GetScreenSpacePosition(), MyGeometry );
if( PossibleSelectedStop.IsValid( *CurveOwner ) )
{
// Only change selection on right click if something was selected
SelectedStop = PossibleSelectedStop;
return FReply::Handled().CaptureMouse( SharedThis( this ) );
}
}
}
return FReply::Unhandled();
}
示例4: OnMouseButtonUp
FReply SProfilerThreadView::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
FReply Reply = FReply::Unhandled();
if( IsReady() )
{
const FVector2D MousePositionOnButtonUp = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
const bool bIsValidForMouseClick = MousePositionOnButtonUp.Equals( MousePositionOnButtonDown, MOUSE_SNAP_DISTANCE );
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
if( bIsLeftMousePressed )
{
// Release the mouse, we are no longer dragging.
Reply = FReply::Handled().ReleaseMouseCapture();
}
bIsLeftMousePressed = false;
}
else if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
if( bIsRightMousePressed )
{
if( bIsValidForMouseClick )
{
ShowContextMenu( MouseEvent.GetScreenSpacePosition() );
Reply = FReply::Handled();
}
}
bIsRightMousePressed = false;
}
}
return Reply;
}
示例5: OnMouseButtonDown
FReply SScrubWidget::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
bool bHandleLeftMouseButton = MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton;
bool bHandleRightMouseButton = MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && bAllowZoom;
bMouseMovedDuringPanning = false;
if ( bHandleLeftMouseButton )
{
if(DraggableBarIndex != INDEX_NONE)
{
DraggingBar = true;
}
else
{
DistanceDragged = 0;
}
// This has prevent throttling on so that viewports continue to run whilst dragging the slider
return FReply::Handled().CaptureMouse( SharedThis(this) ).PreventThrottling();
}
else if ( bHandleRightMouseButton )
{
bPanning = true;
// Always capture mouse if we left or right click on the widget
return FReply::Handled().CaptureMouse(SharedThis(this));
}
return FReply::Unhandled();
}
示例6: OnMouseButtonDown
FReply SSection::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
DistanceDragged = 0;
DragOperation.Reset();
bDragging = false;
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton || MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
// Check for clicking on a key and mark it as the pressed key for drag detection (if necessary) later
PressedKey = GetKeyUnderMouse( MouseEvent.GetScreenSpacePosition(), MyGeometry );
if( !PressedKey.IsValid() && MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
CheckForEdgeInteraction( MouseEvent, MyGeometry );
}
return FReply::Handled().CaptureMouse( AsShared() );
}
else if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
return FReply::Handled().CaptureMouse(AsShared());
}
return FReply::Handled();
}
示例7: OnMouseButtonDown
FReply SAnimationOutlinerTreeNode::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && DisplayNode->IsSelectable() )
{
bool bSelected = DisplayNode->IsSelected();
if( MouseEvent.IsControlDown() )
{
const bool bDeselectOtherNodes = false;
// Select the node if we were clicked on
DisplayNode->SetSelectionState( !bSelected, bDeselectOtherNodes );
}
else
{
const bool bDeselectOtherNodes = true;
// Select the node if we were clicked on
DisplayNode->SetSelectionState( true, bDeselectOtherNodes );
}
OnSelectionChanged.ExecuteIfBound( DisplayNode );
return FReply::Handled();
}
else if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
return FReply::Handled().CaptureMouse(SharedThis(this));
}
return FReply::Unhandled();
}
示例8: OnMouseButtonDown
FReply SGestureTreeItem::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && FMultiBoxSettings::IsInToolbarEditMode())
{
return FReply::Handled().DetectDrag(SharedThis(this), MouseEvent.GetEffectingButton());
}
return FReply::Unhandled();
}
示例9: OnMouseButtonUp
FReply FTextEditHelper::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& InMouseEvent, const TSharedRef< ITextEditorWidget >& TextEditor )
{
FReply Reply = FReply::Unhandled();
// The mouse must have been captured by either left or right button down before we'll process mouse ups
if( TextEditor->GetWidget()->HasMouseCapture() )
{
if( InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton &&
TextEditor->IsDragSelecting() )
{
// No longer drag-selecting
TextEditor->EndDragSelection();
// If we received keyboard focus on this click, then we'll want to select all of the text
// when the user releases the mouse button, unless the user actually dragged the mouse
// while holding the button down, in which case they've already selected some text and
// we'll leave things alone!
if( TextEditor->WasFocusedByLastMouseDown() )
{
if( !TextEditor->HasDragSelectedSinceFocused() )
{
if( TextEditor->SelectAllTextWhenFocused() )
{
// Move the cursor to the end of the string
TextEditor->JumpTo(ETextLocation::EndOfDocument, ECursorAction::MoveCursor);
// User wasn't dragging the mouse, so go ahead and select all of the text now
// that we've become focused
TextEditor->SelectAllText();
// @todo Slate: In this state, the caret should actually stay hidden (until the user interacts again), and we should not move the caret
}
}
TextEditor->SetWasFocusedByLastMouseDown( false );
}
// Release mouse capture
Reply = FReply::Handled();
Reply.ReleaseMouseCapture();
}
else if( InMouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
if ( MyGeometry.IsUnderLocation( InMouseEvent.GetScreenSpacePosition() ) )
{
// Right clicked, so summon a context menu if the cursor is within the widget
TextEditor->SummonContextMenu( InMouseEvent.GetScreenSpacePosition() );
}
// Release mouse capture
Reply = FReply::Handled();
Reply.ReleaseMouseCapture();
}
}
return Reply;
}
示例10: OnMouseButtonDown
FReply SMultiBlockDragHandle::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && Block->GetAction().IsValid() )
{
return FReply::Handled().DetectDrag( SharedThis(this), MouseEvent.GetEffectingButton() );
}
return FReply::Unhandled();
}
示例11: OnMouseButtonUp
FReply SColorGradientEditor::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
const float DragThresholdDist = 5.0f;
if( IsEditingEnabled.Get() == true )
{
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
if( bDraggingStop == true )
{
// We stopped dragging
GEditor->EndTransaction();
}
else if( DistanceDragged < DragThresholdDist && !SelectedStop.IsValid( *CurveOwner ) )
{
FGeometry ColorMarkAreaGeometry = GetColorMarkAreaGeometry( MyGeometry );
FGeometry AlphaMarkAreaGeometry = GetAlphaMarkAreaGeometry( MyGeometry );
if( ColorMarkAreaGeometry.IsUnderLocation( MouseEvent.GetScreenSpacePosition() ) )
{
// Add a new color mark
bool bColorStop = true;
SelectedStop = AddStop( MouseEvent.GetScreenSpacePosition(), MyGeometry, bColorStop );
return FReply::Handled().CaptureMouse( SharedThis(this) );
}
else if( AlphaMarkAreaGeometry.IsUnderLocation( MouseEvent.GetScreenSpacePosition() ) )
{
// Add a new alpha mark
bool bColorStop = false;
SelectedStop = AddStop( MouseEvent.GetScreenSpacePosition(), MyGeometry, bColorStop );
return FReply::Handled().CaptureMouse( SharedThis(this) );
}
}
DistanceDragged = 0;
bDraggingStop = false;
return FReply::Handled().ReleaseMouseCapture();
}
else if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
// Didnt move the mouse too far, open a context menu
if( DistanceDragged < DragThresholdDist && SelectedStop.IsValid( *CurveOwner ) )
{
OpenGradientStopContextMenu( MouseEvent.GetScreenSpacePosition() );
}
DistanceDragged = 0;
return FReply::Handled().ReleaseMouseCapture();
}
}
return FReply::Unhandled();
}
示例12: OnMouseButtonUp
FReply FSceneViewport::OnMouseButtonUp( const FGeometry& InGeometry, const FPointerEvent& InMouseEvent )
{
// Start a new reply state
CurrentReplyState = FReply::Handled();
KeyStateMap.Add( InMouseEvent.GetEffectingButton(), false );
UpdateModifierKeys( InMouseEvent );
UpdateCachedMousePos( InGeometry, InMouseEvent );
UpdateCachedGeometry(InGeometry);
// Switch to the viewport clients world before processing input
FScopedConditionalWorldSwitcher WorldSwitcher( ViewportClient );
bool bCursorVisible = true;
bool bReleaseMouse = true;
if( ViewportClient && GetSizeXY() != FIntPoint::ZeroValue )
{
if (!ViewportClient->InputKey(this, InMouseEvent.GetUserIndex(), InMouseEvent.GetEffectingButton(), IE_Released))
{
CurrentReplyState = FReply::Unhandled();
}
bCursorVisible = ViewportClient->GetCursor(this, GetMouseX(), GetMouseY()) != EMouseCursor::None;
bReleaseMouse =
bCursorVisible ||
ViewportClient->CaptureMouseOnClick() == EMouseCaptureMode::CaptureDuringMouseDown ||
( ViewportClient->CaptureMouseOnClick() == EMouseCaptureMode::CaptureDuringRightMouseDown && InMouseEvent.GetEffectingButton() == EKeys::RightMouseButton );
}
if (!((FApp::IsGame() && !GIsEditor) || bIsPlayInEditorViewport) || bReleaseMouse)
{
// On mouse up outside of the game (editor viewport) or if the cursor is visible in game, we should make sure the mouse is no longer captured
// as long as the left or right mouse buttons are not still down
if( !InMouseEvent.IsMouseButtonDown( EKeys::RightMouseButton ) && !InMouseEvent.IsMouseButtonDown( EKeys::LeftMouseButton ))
{
if( bCursorHiddenDueToCapture )
{
bCursorHiddenDueToCapture = false;
CurrentReplyState.SetMousePos( MousePosBeforeHiddenDueToCapture );
MousePosBeforeHiddenDueToCapture = FIntPoint( -1, -1 );
}
CurrentReplyState.ReleaseMouseCapture();
if (bCursorVisible)
{
CurrentReplyState.ReleaseMouseLock();
}
}
}
return CurrentReplyState;
}
示例13: OnMouseButtonDown
FReply STransformHandle::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if ( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
Action = ComputeActionAtLocation(MyGeometry, MouseEvent);
FWidgetReference SelectedWidget = Designer->GetSelectedWidget();
UWidget* Preview = SelectedWidget.GetPreview();
UWidget* Template = SelectedWidget.GetTemplate();
if ( UCanvasPanelSlot* Slot = Cast<UCanvasPanelSlot>(Preview->Slot) )
{
StartingOffsets = Slot->GetOffsets();
}
MouseDownPosition = MouseEvent.GetScreenSpacePosition();
ScopedTransaction = new FScopedTransaction(LOCTEXT("ResizeWidget", "Resize Widget"));
Template->Modify();
return FReply::Handled().CaptureMouse(SharedThis(this));
}
return FReply::Unhandled();
}
示例14: OnColorBoxClicked
FReply SGraphPinColor::OnColorBoxClicked(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
{
SelectedColor = GetColor();
TArray<FLinearColor*> LinearColorArray;
LinearColorArray.Add(&SelectedColor);
FColorPickerArgs PickerArgs;
PickerArgs.bIsModal = true;
PickerArgs.ParentWidget = AsShared();
PickerArgs.DisplayGamma = TAttribute<float>::Create(TAttribute<float>::FGetter::CreateUObject(GEngine, &UEngine::GetDisplayGamma));
PickerArgs.LinearColorArray = &LinearColorArray;
PickerArgs.OnColorCommitted = FOnLinearColorValueChanged::CreateSP(this, &SGraphPinColor::OnColorCommitted);
PickerArgs.bUseAlpha = true;
OpenColorPicker(PickerArgs);
return FReply::Handled();
}
else
{
return FReply::Unhandled();
}
}
示例15: OnMouseButtonUp
FReply STableViewBase::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if ( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
OnRightMouseButtonUp( MouseEvent );
FReply Reply = FReply::Handled().ReleaseMouseCapture();
bShowSoftwareCursor = false;
// If we have mouse capture, snap the mouse back to the closest location that is within the list's bounds
if ( HasMouseCapture() )
{
FSlateRect ListScreenSpaceRect = MyGeometry.GetClippingRect();
FVector2D CursorPosition = MyGeometry.LocalToAbsolute( SoftwareCursorPosition );
FIntPoint BestPositionInList(
FMath::RoundToInt( FMath::Clamp( CursorPosition.X, ListScreenSpaceRect.Left, ListScreenSpaceRect.Right ) ),
FMath::RoundToInt( FMath::Clamp( CursorPosition.Y, ListScreenSpaceRect.Top, ListScreenSpaceRect.Bottom ) )
);
Reply.SetMousePos(BestPositionInList);
}
return Reply;
}
return FReply::Unhandled();
}