bPanMovesCanvas

bPanMovesCanvas

#Overview

name: bPanMovesCanvas

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bPanMovesCanvas is to control the behavior of camera movement in orthographic viewports within the Unreal Engine 5 editor. Specifically, it determines whether panning moves the canvas and shows the mouse cursor, or if it uses the original camera movement method.

This setting variable is primarily used in the Level Editor viewport system, which is part of the UnrealEd module. It’s referenced in both the LevelEditorViewportSettings class and the EditorViewportClient class.

The value of this variable is set through the Unreal Engine editor settings, as indicated by the UPROPERTY macro with the ‘config’ specifier. Users can modify this setting in the editor’s project settings under the “Level Editor - Viewport” category.

bPanMovesCanvas interacts with other variables and conditions, such as:

Developers should be aware that:

  1. This setting only affects orthographic viewports.
  2. It changes the behavior of panning when using mouse buttons.
  3. It impacts cursor visibility during certain viewport interactions.

Best practices when using this variable include:

  1. Consider user preferences when deciding whether to enable or disable this feature by default.
  2. Provide clear documentation or in-editor tooltips explaining the difference in behavior when this setting is enabled or disabled.
  3. Test viewport navigation thoroughly with both settings to ensure a smooth user experience in both modes.
  4. Be mindful of how this setting might interact with other viewport navigation settings or custom tools that modify viewport behavior.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:324, section: [/Script/UnrealEd.LevelEditorViewportSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorViewportSettings.h:291

Scope (from outer to inner):

file
class        class ULevelEditorViewportSettings : public UObject

Source code excerpt:

	/** If true, moves the canvas and shows the mouse.  If false, uses original camera movement. */
	UPROPERTY(EditAnywhere, config, Category=Controls, meta=(DisplayName = "Grab and Drag to Move Orthographic Cameras"), AdvancedDisplay)
	uint32 bPanMovesCanvas:1;

	/** If checked, in orthographic view ports zooming will center on the mouse position.  If unchecked, the zoom is around the center of the viewport. */
	UPROPERTY(EditAnywhere, config, Category=Controls, meta=(DisplayName = "Orthographic Zoom to Cursor Position"))
	uint32 bCenterZoomAroundCursor:1;

	/** The closest possible distance allowed when viewing through an orthographic camera */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:3477

Scope (from outer to inner):

file
function     bool FEditorViewportClient::ShouldUseMoveCanvasMovement

Source code excerpt:


	//if we're using the new move canvas mode, we're in an ortho viewport, and the mouse is down
	if (GetDefault<ULevelEditorViewportSettings>()->bPanMovesCanvas && IsOrtho() && bMouseButtonDown)
	{
		//MOVING CAMERA
		if ( !MouseDeltaTracker->UsingDragTool() && AltDown == false && ShiftDown == false && ControlDown == false && (Widget->GetCurrentAxis() == EAxisList::None) && (LeftMouseButtonDown ^ RightMouseButtonDown))
		{
			return true;
		}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorViewportClient.cpp:5208

Scope (from outer to inner):

file
function     void FEditorViewportClient::UpdateRequiredCursorVisibility

Source code excerpt:

		}

		if (GetDefault<ULevelEditorViewportSettings>()->bPanMovesCanvas && RightMouseButtonDown)
		{
			bool bMovingCamera = GetCurrentWidgetAxis() == EAxisList::None;
			bool bIsZoomingCamera = bMovingCamera && ( LeftMouseButtonDown || bIsUsingTrackpad );
			//moving camera without  zooming
			if ( bMovingCamera && !bIsZoomingCamera )
			{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/LevelEditorViewport.cpp:5188

Scope (from outer to inner):

file
function     bool FLevelEditorViewportClient::ShouldUseMoveCanvasMovement

Source code excerpt:


	//if we're using the new move canvas mode, we're in an ortho viewport, and the mouse is down
	if (GetDefault<ULevelEditorViewportSettings>()->bPanMovesCanvas && IsOrtho() && bMouseButtonDown)
	{
		//MOVING CAMERA
		if ( !MouseDeltaTracker->UsingDragTool() && AltDown == false && ShiftDown == false && ControlDown == false && (Widget->GetCurrentAxis() == EAxisList::None) && (LeftMouseButtonDown ^ RightMouseButtonDown))
		{
			return true;
		}