本文整理汇总了C++中FDragDropEvent::GetScreenSpacePosition方法的典型用法代码示例。如果您正苦于以下问题:C++ FDragDropEvent::GetScreenSpacePosition方法的具体用法?C++ FDragDropEvent::GetScreenSpacePosition怎么用?C++ FDragDropEvent::GetScreenSpacePosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FDragDropEvent
的用法示例。
在下文中一共展示了FDragDropEvent::GetScreenSpacePosition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDrop
FReply SGraphPin::OnDrop( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
{
TSharedPtr<SGraphNode> NodeWidget = OwnerNodePtr.Pin();
bool bReadOnly = NodeWidget.IsValid() ? !NodeWidget->IsNodeEditable() : false;
TSharedPtr<FDragDropOperation> Operation = DragDropEvent.GetOperation();
if (!Operation.IsValid() || bReadOnly)
{
return FReply::Unhandled();
}
// Is someone dropping a connection onto this pin?
if (Operation->IsOfType<FGraphEditorDragDropAction>())
{
TSharedPtr<FGraphEditorDragDropAction> DragConnectionOp = StaticCastSharedPtr<FGraphEditorDragDropAction>(Operation);
FVector2D NodeAddPosition = FVector2D::ZeroVector;
TSharedPtr<SGraphNode> OwnerNode = OwnerNodePtr.Pin();
if (OwnerNode.IsValid())
{
NodeAddPosition = OwnerNode->GetPosition() + MyGeometry.Position;
//Don't have access to bounding information for node, using fixed offet that should work for most cases.
const float FixedOffset = 200.0f;
//Line it up vertically with pin
NodeAddPosition.Y += MyGeometry.Size.Y;
if(GetDirection() == EEdGraphPinDirection::EGPD_Input)
{
//left side just offset by fixed amount
//@TODO: knowing the width of the node we are about to create would allow us to line this up more precisely,
// but this information is not available currently
NodeAddPosition.X -= FixedOffset;
}
else
{
//right side we need the width of the pin + fixed amount because our reference position is the upper left corner of pin(which is variable length)
NodeAddPosition.X += MyGeometry.Size.X + FixedOffset;
}
}
return DragConnectionOp->DroppedOnPin(DragDropEvent.GetScreenSpacePosition(), NodeAddPosition);
}
// handle dropping an asset on the pin
else if (Operation->IsOfType<FAssetDragDropOp>() && NodeWidget.IsValid())
{
UEdGraphNode* Node = NodeWidget->GetNodeObj();
if(Node != NULL && Node->GetSchema() != NULL)
{
TSharedPtr<FAssetDragDropOp> AssetOp = StaticCastSharedPtr<FAssetDragDropOp>(Operation);
Node->GetSchema()->DroppedAssetsOnPin(AssetOp->AssetData, DragDropEvent.GetScreenSpacePosition(), GraphPinObj);
}
return FReply::Handled();
}
return FReply::Unhandled();
}
示例2: OnDragOver
FReply SGraphPanel::OnDragOver( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
{
TSharedPtr<FDragDropOperation> Operation = DragDropEvent.GetOperation();
if (!Operation.IsValid())
{
return FReply::Unhandled();
}
// Handle Read only graphs
if( !IsEditable.Get() )
{
TSharedPtr<FGraphEditorDragDropAction> GraphDragDropOp = DragDropEvent.GetOperationAs<FGraphEditorDragDropAction>();
if( GraphDragDropOp.IsValid() )
{
GraphDragDropOp->SetDropTargetValid( false );
}
else
{
TSharedPtr<FDecoratedDragDropOp> AssetOp = DragDropEvent.GetOperationAs<FDecoratedDragDropOp>();
if( AssetOp.IsValid() )
{
FText Tooltip = AssetOp->GetHoverText();
if( Tooltip.IsEmpty() )
{
Tooltip = NSLOCTEXT( "GraphPanel", "DragDropOperation", "Graph is Read-Only" );
}
AssetOp->SetToolTip( Tooltip, FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.Error")));
}
}
return FReply::Handled();
}
if( Operation->IsOfType<FGraphEditorDragDropAction>() )
{
PreviewConnectorEndpoint = MyGeometry.AbsoluteToLocal( DragDropEvent.GetScreenSpacePosition() );
return FReply::Handled();
}
else if (Operation->IsOfType<FExternalDragOperation>())
{
return AssetUtil::CanHandleAssetDrag(DragDropEvent);
}
else if (Operation->IsOfType<FAssetDragDropOp>())
{
if(GraphObj != NULL && GraphObj->GetSchema())
{
TSharedPtr<FAssetDragDropOp> AssetOp = StaticCastSharedPtr<FAssetDragDropOp>(Operation);
bool bOkIcon = false;
FString TooltipText;
GraphObj->GetSchema()->GetAssetsGraphHoverMessage(AssetOp->AssetData, GraphObj, TooltipText, bOkIcon);
const FSlateBrush* TooltipIcon = bOkIcon ? FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.OK")) : FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.Error"));;
AssetOp->SetToolTip(FText::FromString(TooltipText), TooltipIcon);
}
return FReply::Handled();
}
else
{
return FReply::Unhandled();
}
}
示例3: OnCustomCommandDragged
void SMultiBoxWidget::OnCustomCommandDragged( TSharedRef<const FMultiBlock> MultiBlock, const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
{
if( MultiBlock != DragPreview.PreviewBlock && MultiBox->IsInEditMode() )
{
TSharedPtr<FUICommandDragDropOp> DragDropContent = StaticCastSharedPtr<FUICommandDragDropOp>( DragDropEvent.GetOperation() );
UpdateDropAreaPreviewBlock( MultiBlock, DragDropContent, MyGeometry, DragDropEvent.GetScreenSpacePosition() );
}
}
示例4: OnDragged
/**
* Called when the mouse was moved during a drag and drop operation
*
* @param DragDropEvent The event that describes this drag drop operation.
*/
void FDockingDragOperation::OnDragged( const FDragDropEvent& DragDropEvent )
{
const bool bPreviewingTarget = HoveredDockTarget.TargetNode.IsValid();
if ( !bPreviewingTarget )
{
// The tab is being dragged. Move the the decorator window to match the cursor position.
FVector2D TargetPosition = DragDropEvent.GetScreenSpacePosition() - GetDecoratorOffsetFromCursor();
CursorDecoratorWindow->UpdateMorphTargetShape( FSlateRect(TargetPosition.X, TargetPosition.Y, TargetPosition.X + LastContentSize.X, TargetPosition.Y + LastContentSize.Y) );
CursorDecoratorWindow->MoveWindowTo( TargetPosition );
}
}
示例5: OnDrop
FReply SGraphPanel::OnDrop( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
{
const FVector2D NodeAddPosition = PanelCoordToGraphCoord( MyGeometry.AbsoluteToLocal( DragDropEvent.GetScreenSpacePosition() ) );
FSlateApplication::Get().SetKeyboardFocus(AsShared(), EFocusCause::SetDirectly);
TSharedPtr<FDragDropOperation> Operation = DragDropEvent.GetOperation();
if (!Operation.IsValid() || !IsEditable.Get())
{
return FReply::Unhandled();
}
if (Operation->IsOfType<FGraphEditorDragDropAction>())
{
check(GraphObj);
TSharedPtr<FGraphEditorDragDropAction> DragConn = StaticCastSharedPtr<FGraphEditorDragDropAction>(Operation);
if (DragConn.IsValid() && DragConn->IsSupportedBySchema(GraphObj->GetSchema()))
{
return DragConn->DroppedOnPanel(SharedThis(this), DragDropEvent.GetScreenSpacePosition(), NodeAddPosition, *GraphObj);
}
return FReply::Unhandled();
}
else if (Operation->IsOfType<FActorDragDropGraphEdOp>())
{
TSharedPtr<FActorDragDropGraphEdOp> ActorOp = StaticCastSharedPtr<FActorDragDropGraphEdOp>(Operation);
OnDropActor.ExecuteIfBound(ActorOp->Actors, GraphObj, NodeAddPosition);
return FReply::Handled();
}
else if (Operation->IsOfType<FLevelDragDropOp>())
{
TSharedPtr<FLevelDragDropOp> LevelOp = StaticCastSharedPtr<FLevelDragDropOp>(Operation);
OnDropStreamingLevel.ExecuteIfBound(LevelOp->StreamingLevelsToDrop, GraphObj, NodeAddPosition);
return FReply::Handled();
}
else
{
if(GraphObj != NULL && GraphObj->GetSchema() != NULL)
{
TArray< FAssetData > DroppedAssetData = AssetUtil::ExtractAssetDataFromDrag( DragDropEvent );
if ( DroppedAssetData.Num() > 0 )
{
GraphObj->GetSchema()->DroppedAssetsOnGraph( DroppedAssetData, NodeAddPosition, GraphObj );
return FReply::Handled();
}
}
return FReply::Unhandled();
}
}
示例6: GetDragDropScreenSpacePosition
FVector2D STrackNode::GetDragDropScreenSpacePosition(const FGeometry& ParentAllottedGeometry, const FDragDropEvent& DragDropEvent) const
{
FVector2D DragDropPos = DragDropEvent.GetScreenSpacePosition();
TSharedPtr<FTrackNodeDragDropOp> DragDropOp = StaticCastSharedPtr<FTrackNodeDragDropOp>(DragDropEvent.GetOperation());
if(DragDropOp.IsValid())
{
DragDropPos += DragDropOp->Offset;
}
if(bCenterOnPosition)
{
// Correct for center-on-position offset
FVector2D Size = GetSizeRelativeToParent(ParentAllottedGeometry);
DragDropPos.X += Size.X/2.f;
}
return DragDropPos;
}
示例7: OnDrop
// drag drop relationship
FReply STrack::OnDrop( const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent )
{
FVector2D CursorPos = MyGeometry.AbsoluteToLocal(DragDropEvent.GetScreenSpacePosition());
float CusorDataPos = LocalToDataX(CursorPos.X, MyGeometry);
// Handle TrackNodes that were dropped
if ( DragDrop::IsTypeMatch<FTrackNodeDragDropOp>( DragDropEvent.GetOperation() ) )
{
TSharedPtr<FTrackNodeDragDropOp> DragDropOp = StaticCastSharedPtr<FTrackNodeDragDropOp>(DragDropEvent.GetOperation());
TSharedPtr<STrackNode> TrackNode = DragDropOp->OriginalTrackNode.Pin();
float DataPos = GetNodeDragDropDataPos(MyGeometry, DragDropEvent);
TrackNode->OnTrackNodeDragged.ExecuteIfBound( DataPos );
TrackNode->OnTrackNodeDropped.ExecuteIfBound();
}
// Call delegate to handle anything else
OnTrackDragDrop.ExecuteIfBound( DragDropEvent.GetOperation(), CusorDataPos );
return FReply::Unhandled();
}