2016-12-08 08:52:44 -05:00
|
|
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
2016-06-14 11:34:25 -04:00
|
|
|
|
|
|
|
|
#include "ViewportDragOperation.h"
|
|
|
|
|
|
|
|
|
|
UViewportDragOperationComponent::UViewportDragOperationComponent( const class FObjectInitializer& Initializer ) :
|
|
|
|
|
Super( Initializer ),
|
|
|
|
|
DragOperation( nullptr )
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UViewportDragOperationComponent::~UViewportDragOperationComponent()
|
|
|
|
|
{
|
|
|
|
|
DragOperation = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UViewportDragOperation* UViewportDragOperationComponent::GetDragOperation()
|
|
|
|
|
{
|
|
|
|
|
return DragOperation;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-23 13:47:36 -04:00
|
|
|
void UViewportDragOperationComponent::SetDragOperationClass( const TSubclassOf<UViewportDragOperation> InDragOperation )
|
2016-06-14 11:34:25 -04:00
|
|
|
{
|
|
|
|
|
DragOperationSubclass = InDragOperation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UViewportDragOperationComponent::StartDragOperation()
|
|
|
|
|
{
|
|
|
|
|
if ( DragOperationSubclass )
|
|
|
|
|
{
|
|
|
|
|
// Reset the drag operation to make sure we start a new one
|
|
|
|
|
ClearDragOperation();
|
|
|
|
|
// Create the drag object with the latest class
|
|
|
|
|
DragOperation = NewObject<UViewportDragOperation>( ( UObject* ) GetTransientPackage(), DragOperationSubclass );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UViewportDragOperationComponent::ClearDragOperation()
|
|
|
|
|
{
|
|
|
|
|
if ( DragOperation )
|
|
|
|
|
{
|
|
|
|
|
DragOperation->MarkPendingKill();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DragOperation = nullptr;
|
|
|
|
|
}
|
2017-03-01 12:26:39 -05:00
|
|
|
|
|
|
|
|
bool UViewportDragOperationComponent::IsDragging() const
|
|
|
|
|
{
|
|
|
|
|
return DragOperation != nullptr;
|
|
|
|
|
}
|