当前位置: 首页>>代码示例>>C++>>正文


C++ FPointerEvent::GetWheelDelta方法代码示例

本文整理汇总了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();
}
开发者ID:aovi,项目名称:UnrealEngine4,代码行数:30,代码来源:SPaperEditorViewport.cpp

示例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();
}
开发者ID:Helical-Games,项目名称:HeliumRain,代码行数:10,代码来源:FlareKeyBind.cpp

示例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);
}
开发者ID:20tab,项目名称:UnrealEnginePython,代码行数:20,代码来源:SPythonEditableText.cpp

示例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();
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:21,代码来源:TimeSliderController.cpp

示例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();
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:12,代码来源:ScrollyZoomy.cpp

示例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;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:16,代码来源:CEFWebBrowserWindow.cpp

示例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;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:16,代码来源:SProfilerThreadView.cpp

示例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();
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:47,代码来源:TimeSliderController.cpp

示例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);
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:18,代码来源:WebBrowserWindow.cpp

示例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();
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:19,代码来源:SAnimTrackPanel.cpp

示例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();
	}
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:19,代码来源:SFlipbookTimeline.cpp

示例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();
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:19,代码来源:SAnimCurveEd.cpp

示例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();
}
开发者ID:PopCap,项目名称:GameIdea,代码行数:21,代码来源:SScrubWidget.cpp

示例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;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:22,代码来源:SceneViewport.cpp

示例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();
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:24,代码来源:STableViewBase.cpp


注:本文中的FPointerEvent::GetWheelDelta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。