mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Fix 3D manipulator the gizmo growing too large on small viewports
This closes #27112. This closes #19116.
This commit is contained in:
		
							parent
							
								
									4d08f72b76
								
							
						
					
					
						commit
						20154d3b2a
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		|  | @ -2922,8 +2922,14 @@ void SpatialEditorViewport::update_transform_gizmo_view() { | |||
| 	if (dd == 0) | ||||
| 		dd = 0.0001; | ||||
| 
 | ||||
| 	float gsize = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_size"); | ||||
| 	gizmo_scale = (gsize / Math::abs(dd)) * MAX(1, EDSCALE) / viewport_container->get_stretch_shrink(); | ||||
| 	float gizmo_size = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_size"); | ||||
| 	// At low viewport heights, multiply the gizmo scale based on the viewport height.
 | ||||
| 	// This prevents the gizmo from growing very large and going outside the viewport.
 | ||||
| 	const int viewport_base_height = 400 * MAX(1, EDSCALE); | ||||
| 	gizmo_scale = | ||||
| 			(gizmo_size / Math::abs(dd)) * MAX(1, EDSCALE) * | ||||
| 			MIN(viewport_base_height, viewport_container->get_size().height) / viewport_base_height / | ||||
| 			viewport_container->get_stretch_shrink(); | ||||
| 	Vector3 scale = Vector3(1, 1, 1) * gizmo_scale; | ||||
| 
 | ||||
| 	xform.basis.scale(scale); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hugo Locurcio
						Hugo Locurcio