You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#review vincent.gauthier #preflight 60783dbd06b89e000178adb1 [CL 16025206 by Patrick Boutot in ue5-main branch]
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Designer/SZoomPan.h"
|
|
#include "Layout/LayoutUtils.h"
|
|
|
|
/////////////////////////////////////////////////////
|
|
// SZoomPan
|
|
|
|
void SZoomPan::Construct(const FArguments& InArgs)
|
|
{
|
|
bHasRelativeLayoutScale = true;
|
|
|
|
ViewOffset = InArgs._ViewOffset;
|
|
ZoomAmount = InArgs._ZoomAmount;
|
|
|
|
ChildSlot
|
|
[
|
|
InArgs._Content.Widget
|
|
];
|
|
}
|
|
|
|
void SZoomPan::SetContent(const TSharedRef< SWidget >& InContent)
|
|
{
|
|
ChildSlot
|
|
[
|
|
InContent
|
|
];
|
|
}
|
|
|
|
void SZoomPan::OnArrangeChildren(const FGeometry& AllottedGeometry, FArrangedChildren& ArrangedChildren) const
|
|
{
|
|
const EVisibility ChildVisibility = ChildSlot.GetWidget()->GetVisibility();
|
|
if ( ArrangedChildren.Accepts(ChildVisibility) )
|
|
{
|
|
const FMargin SlotPadding(ChildSlot.GetPadding());
|
|
AlignmentArrangeResult XResult = AlignChild<Orient_Horizontal>(AllottedGeometry.Size.X, ChildSlot, SlotPadding, 1);
|
|
AlignmentArrangeResult YResult = AlignChild<Orient_Vertical>(AllottedGeometry.Size.Y, ChildSlot, SlotPadding, 1);
|
|
|
|
ArrangedChildren.AddWidget( ChildVisibility, AllottedGeometry.MakeChild(
|
|
ChildSlot.GetWidget(),
|
|
FVector2D(XResult.Offset, YResult.Offset) - ViewOffset.Get(),
|
|
ChildSlot.GetWidget()->GetDesiredSize(),
|
|
ZoomAmount.Get()
|
|
) );
|
|
}
|
|
}
|
|
|
|
float SZoomPan::GetRelativeLayoutScale(int32 ChildIndex, float LayoutScaleMultiplier) const
|
|
{
|
|
return ZoomAmount.Get();
|
|
}
|