本文整理汇总了C++中FPointerEvent::GetWheelDelta方法的典型用法代码示例。如果您正苦于以下问题:C++ FPointerEvent::GetWheelDelta方法的具体用法?C++ FPointerEvent::GetWheelDelta怎么用?C++ FPointerEvent::GetWheelDelta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPointerEvent
的用法示例。
在下文中一共展示了FPointerEvent::GetWheelDelta方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseWheel
FReply SPaperEditorViewport::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
// We want to zoom into this point; i.e. keep it the same fraction offset into the panel
const FVector2D WidgetSpaceCursorPos = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
FVector2D PointToMaintainGraphSpace = PanelCoordToGraphCoord( WidgetSpaceCursorPos );
const int32 ZoomLevelDelta = FMath::FloorToInt(MouseEvent.GetWheelDelta());
const bool bAllowFullZoomRange = true;
const float OldZoomLevel = ZoomLevel;
if (bAllowFullZoomRange)
{
ZoomLevel = FMath::Clamp( ZoomLevel + ZoomLevelDelta, 0, NumZoomLevels-1 );
}
else
{
// Without control, we do not allow zooming out past 1:1.
ZoomLevel = FMath::Clamp( ZoomLevel + ZoomLevelDelta, 0, DefaultZoomLevel );
}
ZoomLevelFade.Play(this->AsShared());
// Re-center the screen so that it feels like zooming around the cursor.
ViewOffset = PointToMaintainGraphSpace - WidgetSpaceCursorPos / GetZoomAmount();
return FReply::Handled();
}
示例2: OnMouseWheel
FReply SFlareKeyBind::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (bWaitingForKey)
{
SetKey(MouseEvent.GetWheelDelta() > 0 ? EKeys::MouseScrollUp : EKeys::MouseScrollDown);
return FReply::Handled();
}
return FReply::Unhandled();
}
示例3: OnMouseWheel
FReply SPythonEditableText::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& InPointerEvent)
{
if (FSlateApplication::Get().GetModifierKeys().IsControlDown())
{
if (InPointerEvent.GetWheelDelta() > 0)
{
CurrentScale += 0.1;
}
else if (InPointerEvent.GetWheelDelta() < 0)
{
CurrentScale -= 0.1;
}
if (CurrentScale < 1)
CurrentScale = 1;
SetRenderTransform(FSlateRenderTransform(CurrentScale));
return FReply::Handled();
}
return SMultiLineEditableText::OnMouseWheel(MyGeometry, InPointerEvent);
}
示例4: OnMouseWheel
FReply FSequencerTimeSliderController::OnMouseWheel( SWidget& WidgetOwner, const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
TOptional<TRange<float>> NewTargetRange;
float MouseFractionX = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition()).X / MyGeometry.GetLocalSize().X;
if ( TimeSliderArgs.AllowZoom && MouseEvent.IsControlDown() )
{
const float ZoomDelta = -0.2f * MouseEvent.GetWheelDelta();
if (ZoomByDelta(ZoomDelta, MouseFractionX))
{
return FReply::Handled();
}
}
else if (MouseEvent.IsShiftDown())
{
PanByDelta(-MouseEvent.GetWheelDelta());
return FReply::Handled();
}
return FReply::Unhandled();
}
示例5: OnMouseWheel
FReply FScrollyZoomy::OnMouseWheel( const FPointerEvent& MouseEvent, IScrollableZoomable& ScrollableZoomable )
{
// @todo: Inertial zoom support!
const bool DidZoom = ScrollableZoomable.ZoomBy(MouseEvent.GetWheelDelta());
if (DidZoom)
{
return FReply::Handled();
}
return FReply::Unhandled();
}
示例6: OnMouseWheel
FReply FCEFWebBrowserWindow::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup)
{
FReply Reply = FReply::Unhandled();
if(IsValid())
{
// The original delta is reduced so this should bring it back to what CEF expects
const float SpinFactor = 50.0f;
const float TrueDelta = MouseEvent.GetWheelDelta() * SpinFactor;
CefMouseEvent Event = GetCefMouseEvent(MyGeometry, MouseEvent, bIsPopup);
InternalCefBrowser->GetHost()->SendMouseWheelEvent(Event,
MouseEvent.IsShiftDown() ? TrueDelta : 0,
!MouseEvent.IsShiftDown() ? TrueDelta : 0);
Reply = FReply::Handled();
}
return Reply;
}
示例7: OnMouseWheel
FReply SProfilerThreadView::OnMouseWheel( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
FReply Reply = FReply::Unhandled();
const bool bZoomIn = MouseEvent.GetWheelDelta() < 0.0f;
const double Center = PositionXMS + RangeXMS*0.5f;
const double MinVisibleRangeMS = 1.0f / INV_MIN_VISIBLE_RANGE_X;
const double NewUnclampedRange = bZoomIn ? RangeXMS*1.25f : RangeXMS / 1.25f;
const double NewRange = FMath::Clamp( NewUnclampedRange, MinVisibleRangeMS, FMath::Min( TotalRangeXMS, (double)MAX_VISIBLE_RANGE_X ) );
const double NewPositionX = FMath::Clamp( Center, NewRange*0.5f, TotalRangeXMS - NewRange*0.5f ) - NewRange*0.5f;
SetTimeRange( NewPositionX, NewPositionX + NewRange );
return Reply;
}
示例8: OnMouseWheel
FReply FSequencerTimeSliderController::OnMouseWheel( TSharedRef<SWidget> WidgetOwner, const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if ( TimeSliderArgs.AllowZoom )
{
const float ZoomDelta = -0.1f * MouseEvent.GetWheelDelta();
{
TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
float LocalViewRangeMax = LocalViewRange.GetUpperBoundValue();
float LocalViewRangeMin = LocalViewRange.GetLowerBoundValue();
const float OutputViewSize = LocalViewRangeMax - LocalViewRangeMin;
const float OutputChange = OutputViewSize * ZoomDelta;
float NewViewOutputMin = LocalViewRangeMin - (OutputChange * 0.5f);
float NewViewOutputMax = LocalViewRangeMax + (OutputChange * 0.5f);
if( FMath::Abs( OutputChange ) > 0.01f && NewViewOutputMin < NewViewOutputMax )
{
TOptional<float> LocalClampMin = TimeSliderArgs.ClampMin.Get();
TOptional<float> LocalClampMax = TimeSliderArgs.ClampMax.Get();
// Clamp the range if clamp values are set
if ( LocalClampMin.IsSet() && NewViewOutputMin < LocalClampMin.GetValue() )
{
NewViewOutputMin = LocalClampMin.GetValue();
}
if ( LocalClampMax.IsSet() && NewViewOutputMax > LocalClampMax.GetValue() )
{
NewViewOutputMax = LocalClampMax.GetValue();
}
TimeSliderArgs.OnViewRangeChanged.ExecuteIfBound(TRange<float>(NewViewOutputMin, NewViewOutputMax));
if( !TimeSliderArgs.ViewRange.IsBound() )
{
// The output is not bound to a delegate so we'll manage the value ourselves
TimeSliderArgs.ViewRange.Set( TRange<float>( NewViewOutputMin, NewViewOutputMax ) );
}
}
}
return FReply::Handled();
}
return FReply::Unhandled();
}
示例9: OnMouseWheel
void FWebBrowserWindow::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if(IsValid())
{
// The original delta is reduced so this should bring it back to what CEF expects
const float SpinFactor = 120.0f;
const float TrueDelta = MouseEvent.GetWheelDelta() * SpinFactor;
CefMouseEvent Event;
FVector2D LocalPos = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition());
Event.x = LocalPos.X;
Event.y = LocalPos.Y;
Event.modifiers = GetCefMouseModifiers(MouseEvent);
InternalCefBrowser->GetHost()->SendMouseWheelEvent(Event,
MouseEvent.IsShiftDown() ? TrueDelta : 0,
!MouseEvent.IsShiftDown() ? TrueDelta : 0);
}
}
示例10: OnMouseWheel
FReply SAnimTrackPanel::OnMouseWheel( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
const float ZoomDelta = -0.1f * MouseEvent.GetWheelDelta();
const FVector2D MouseWidgetPos = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition());
const float ZoomRatio = FMath::Clamp((MouseWidgetPos.X / (MyGeometry.Size.X - WidgetWidth)), 0.f, 1.f);
{
const float InputViewSize = ViewInputMax.Get() - ViewInputMin.Get();
const float InputChange = InputViewSize * ZoomDelta;
float ViewMinInput = ViewInputMin.Get() - (InputChange * ZoomRatio);
float ViewMaxInput = ViewInputMax.Get() + (InputChange * (1.f - ZoomRatio));
OnSetInputViewRange.Execute(ViewMinInput, ViewMaxInput);
}
return FReply::Handled();
}
示例11: OnMouseWheel
FReply SFlipbookTimeline::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (MouseEvent.IsControlDown())
{
const float DirectionScale = 0.08f;
const float MinFrameSize = 16.0f;
const float Direction = MouseEvent.GetWheelDelta();
const float NewUnitsPerFrame = FMath::Max(MinFrameSize, SlateUnitsPerFrame * (1.0f + Direction * DirectionScale));
SlateUnitsPerFrame = NewUnitsPerFrame;
CheckForRebuild(/*bRebuildAll=*/ true);
return FReply::Handled();
}
else
{
return FReply::Unhandled();
}
}
示例12: OnMouseWheel
FReply SAnimCurveEd::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
const float ZoomDelta = -0.1f * MouseEvent.GetWheelDelta();
const FVector2D WidgetSpace = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition());
const float ZoomRatio = FMath::Clamp((WidgetSpace.X / MyGeometry.Size.X), 0.f, 1.f);
{
const float InputViewSize = ViewMaxInput.Get() - ViewMinInput.Get();
const float InputChange = InputViewSize * ZoomDelta;
float NewViewMinInput = ViewMinInput.Get() - (InputChange * ZoomRatio);
float NewViewMaxInput = ViewMaxInput.Get() + (InputChange * (1.f - ZoomRatio));
SetInputMinMax(NewViewMinInput, NewViewMaxInput);
}
return FReply::Handled();
}
示例13: OnMouseWheel
FReply SScrubWidget::OnMouseWheel( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if ( bAllowZoom && OnSetInputViewRange.IsBound() )
{
const float ZoomDelta = -0.1f * MouseEvent.GetWheelDelta();
{
const float InputViewSize = ViewInputMax.Get() - ViewInputMin.Get();
const float InputChange = InputViewSize * ZoomDelta;
float ViewMinInput = ViewInputMin.Get() - (InputChange * 0.5f);
float ViewMaxInput = ViewInputMax.Get() + (InputChange * 0.5f);
OnSetInputViewRange.Execute(ViewMinInput, ViewMaxInput);
}
return FReply::Handled();
}
return FReply::Unhandled();
}
示例14: OnMouseWheel
FReply FSceneViewport::OnMouseWheel( const FGeometry& InGeometry, const FPointerEvent& InMouseEvent )
{
// Start a new reply state
CurrentReplyState = FReply::Handled();
UpdateCachedMousePos( InGeometry, InMouseEvent );
UpdateCachedGeometry(InGeometry);
if( ViewportClient && GetSizeXY() != FIntPoint::ZeroValue )
{
// Switch to the viewport clients world before processing input
FScopedConditionalWorldSwitcher WorldSwitcher( ViewportClient );
// The viewport client accepts two different keys depending on the direction of scroll.
FKey const ViewportClientKey = InMouseEvent.GetWheelDelta() < 0 ? EKeys::MouseScrollDown : EKeys::MouseScrollUp;
// Pressed and released should be sent
ViewportClient->InputKey( this, 0, ViewportClientKey, IE_Pressed );
ViewportClient->InputKey( this, 0, ViewportClientKey, IE_Released );
}
return CurrentReplyState;
}
示例15: OnMouseWheel
FReply STableViewBase::OnMouseWheel( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if( !MouseEvent.IsControlDown() )
{
// Make sure scroll velocity is cleared so it doesn't fight with the mouse wheel input
this->InertialScrollManager.ClearScrollVelocity();
const float AmountScrolledInItems = this->ScrollBy( MyGeometry, -MouseEvent.GetWheelDelta()*WheelScrollAmount, EAllowOverscroll::No );
switch ( ConsumeMouseWheel )
{
case EConsumeMouseWheel::Always:
return FReply::Handled();
case EConsumeMouseWheel::WhenScrollingPossible: //default behavior
default:
if ( FMath::Abs( AmountScrolledInItems ) > 0.0f )
{
return FReply::Handled();
}
}
}
return FReply::Unhandled();
}