2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*  scroll_container.cpp                                                  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                         This file is part of:                          */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                             GODOT ENGINE                               */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                        https://godotengine.org                         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Permission is hereby granted, free of charge, to any person obtaining  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* a copy of this software and associated documentation files (the        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* "Software"), to deal in the Software without restriction, including    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* without limitation the rights to use, copy, modify, merge, publish,    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* distribute, sublicense, and/or sell copies of the Software, and to     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* permit persons to whom the Software is furnished to do so, subject to  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* the following conditions:                                              */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* The above copyright notice and this permission notice shall be         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* included in all copies or substantial portions of the Software.        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
									
										
										
										
											2018-01-05 00:50:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "scroll_container.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-02-12 02:46:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/config/project_settings.h" 
  
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/panel_container.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-03-03 22:51:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/main/window.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-09-08 21:00:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/theme/theme_db.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-09-26 16:35:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Size2  ScrollContainer : : get_minimum_size ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Calculated in this function, as it needs to traverse all child controls once to calculate;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// and needs to be calculated before being used by update_scrollbars().
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									largest_child_min_size  =  Size2 ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-12 10:44:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  get_child_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-19 00:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Control  * c  =  as_sortable_control ( get_child ( i ) ,  SortableVisibilityMode : : VISIBLE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-06 12:38:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! c )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-12 10:44:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( c  = =  h_scroll  | |  c  = =  v_scroll  | |  c  = =  focus_panel )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-12 10:44:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-12 10:44:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Size2  child_min_size  =  c - > get_combined_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-03 12:49:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										largest_child_min_size  =  largest_child_min_size . max ( child_min_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 14:12:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-08-30 02:08:54 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  min_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Size2  size  =  get_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 14:12:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( horizontal_scroll_mode  = =  SCROLL_MODE_DISABLED )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-30 02:08:54 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										min_size . x  =  largest_child_min_size . x ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bool  v_scroll_show  =  vertical_scroll_mode  = =  SCROLL_MODE_SHOW_ALWAYS  | |  vertical_scroll_mode  = =  SCROLL_MODE_RESERVE  | |  ( vertical_scroll_mode  = =  SCROLL_MODE_AUTO  & &  largest_child_min_size . y  >  size . y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-30 02:08:54 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( v_scroll_show  & &  v_scroll - > get_parent ( )  = =  this )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											min_size . x  + =  v_scroll - > get_minimum_size ( ) . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-12 10:44:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-08-30 02:08:54 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( vertical_scroll_mode  = =  SCROLL_MODE_DISABLED )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										min_size . y  =  largest_child_min_size . y ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bool  h_scroll_show  =  horizontal_scroll_mode  = =  SCROLL_MODE_SHOW_ALWAYS  | |  horizontal_scroll_mode  = =  SCROLL_MODE_RESERVE  | |  ( horizontal_scroll_mode  = =  SCROLL_MODE_AUTO  & &  largest_child_min_size . x  >  size . x ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-30 02:08:54 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( h_scroll_show  & &  h_scroll - > get_parent ( )  = =  this )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											min_size . y  + =  h_scroll - > get_minimum_size ( ) . y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-12 10:44:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 14:12:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  panel_size  =  theme_cache . panel_style - > get_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									min_size  + =  panel_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( draw_focus_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Size2  focus_size  =  theme_cache . focus_style - > get_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Only update the minimum size if the focus style's minimum size doesn't fit into the panel style's minimum size.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_size  >  panel_size )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											min_size  + =  focus_size  -  panel_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-03-12 10:44:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  min_size ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : _cancel_drag ( )  {  
						 
					
						
							
								
									
										
										
										
											2025-04-11 17:14:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_process_internal ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									drag_touching_deaccel  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									drag_touching  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									drag_speed  =  Vector2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									drag_accum  =  Vector2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									last_drag_accum  =  Vector2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									drag_from  =  Vector2 ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( beyond_deadzone )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_signal ( SNAME ( " scroll_ended " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										propagate_notification ( NOTIFICATION_SCROLL_END ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										beyond_deadzone  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  ScrollContainer : : _is_h_scroll_visible ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Scrolls may have been moved out for reasons.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  h_scroll - > is_visible ( )  & &  h_scroll - > get_parent ( )  = =  this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  ScrollContainer : : _is_v_scroll_visible ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  v_scroll - > is_visible ( )  & &  v_scroll - > get_parent ( )  = =  this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-22 12:37:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : gui_input ( const  Ref < InputEvent >  & p_gui_input )  {  
						 
					
						
							
								
									
										
										
										
											2021-04-05 08:52:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND ( p_gui_input . is_null ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 18:53:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  prev_v_scroll  =  v_scroll - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  prev_h_scroll  =  h_scroll - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  h_scroll_enabled  =  horizontal_scroll_mode  ! =  SCROLL_MODE_DISABLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  v_scroll_enabled  =  vertical_scroll_mode  ! =  SCROLL_MODE_DISABLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 18:53:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < InputEventMouseButton >  mb  =  p_gui_input ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mb - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  scroll_value_modified  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  v_scroll_hidden  =  ! v_scroll - > is_visible ( )  & &  vertical_scroll_mode  ! =  SCROLL_MODE_SHOW_NEVER ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( mb - > get_button_index ( )  = =  MouseButton : : WHEEL_UP )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// By default, the vertical orientation takes precedence. This is an exception.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ( h_scroll_enabled  & &  mb - > is_shift_pressed ( ) )  | |  v_scroll_hidden )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													h_scroll - > scroll ( - h_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR  *  mb - > get_factor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													scroll_value_modified  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if  ( v_scroll_enabled )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													v_scroll - > scroll ( - v_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR  *  mb - > get_factor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													scroll_value_modified  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( mb - > get_button_index ( )  = =  MouseButton : : WHEEL_DOWN )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ( h_scroll_enabled  & &  mb - > is_shift_pressed ( ) )  | |  v_scroll_hidden )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													h_scroll - > scroll ( h_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR  *  mb - > get_factor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													scroll_value_modified  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if  ( v_scroll_enabled )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													v_scroll - > scroll ( v_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR  *  mb - > get_factor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													scroll_value_modified  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-22 00:45:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bool  h_scroll_hidden  =  ! h_scroll - > is_visible ( )  & &  horizontal_scroll_mode  ! =  SCROLL_MODE_SHOW_NEVER ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( mb - > get_button_index ( )  = =  MouseButton : : WHEEL_LEFT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// By default, the horizontal orientation takes precedence. This is an exception.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ( v_scroll_enabled  & &  mb - > is_shift_pressed ( ) )  | |  h_scroll_hidden )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													v_scroll - > scroll ( - v_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR  *  mb - > get_factor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													scroll_value_modified  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if  ( h_scroll_enabled )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													h_scroll - > scroll ( - h_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR  *  mb - > get_factor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													scroll_value_modified  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-22 00:45:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( mb - > get_button_index ( )  = =  MouseButton : : WHEEL_RIGHT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ( v_scroll_enabled  & &  mb - > is_shift_pressed ( ) )  | |  h_scroll_hidden )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													v_scroll - > scroll ( v_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR  *  mb - > get_factor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													scroll_value_modified  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if  ( h_scroll_enabled )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													h_scroll - > scroll ( h_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR  *  mb - > get_factor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													scroll_value_modified  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( scroll_value_modified  & &  ( v_scroll - > get_value ( )  ! =  prev_v_scroll  | |  h_scroll - > get_value ( )  ! =  prev_h_scroll ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												accept_event ( ) ;  // Accept event if scroll changed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 18:53:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-17 00:59:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bool  is_touchscreen_available  =  DisplayServer : : get_singleton ( ) - > is_touchscreen_available ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! is_touchscreen_available )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mb - > get_button_index ( )  ! =  MouseButton : : LEFT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mb - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( drag_touching )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												_cancel_drag ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-26 15:08:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											drag_speed  =  Vector2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											drag_accum  =  Vector2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											last_drag_accum  =  Vector2 ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											drag_from  =  Vector2 ( prev_h_scroll ,  prev_v_scroll ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 23:57:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											drag_touching  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-26 15:08:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											drag_touching_deaccel  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											beyond_deadzone  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											time_since_motion  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-11 17:14:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											set_process_internal ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-03 23:57:07 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											time_since_motion  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( drag_touching )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( drag_speed  = =  Vector2 ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													_cancel_drag ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													drag_touching_deaccel  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < InputEventMouseMotion >  mm  =  p_gui_input ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mm . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( drag_touching  & &  ! drag_touching_deaccel )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 20:43:43 +05:45 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Vector2  motion  =  mm - > get_relative ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											drag_accum  - =  motion ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( beyond_deadzone  | |  ( h_scroll_enabled  & &  Math : : abs ( drag_accum . x )  >  deadzone )  | |  ( v_scroll_enabled  & &  Math : : abs ( drag_accum . y )  >  deadzone ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! beyond_deadzone )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													propagate_notification ( NOTIFICATION_SCROLL_BEGIN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													emit_signal ( SNAME ( " scroll_started " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													beyond_deadzone  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													// Resetting drag_accum here ensures smooth scrolling after reaching deadzone.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													drag_accum  =  - motion ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector2  diff  =  drag_from  +  drag_accum ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( h_scroll_enabled )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-21 19:10:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													h_scroll - > scroll_to ( diff . x ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													drag_accum . x  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( v_scroll_enabled )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-21 19:10:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													v_scroll - > scroll_to ( diff . y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													drag_accum . y  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												time_since_motion  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( v_scroll - > get_value ( )  ! =  prev_v_scroll  | |  h_scroll - > get_value ( )  ! =  prev_h_scroll )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											accept_event ( ) ;  // Accept event if scroll changed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-01 21:49:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < InputEventPanGesture >  pan_gesture  =  p_gui_input ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( pan_gesture . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( h_scroll_enabled )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											h_scroll - > scroll ( h_scroll - > get_page ( )  *  pan_gesture - > get_delta ( ) . x  /  ScrollBar : : PAGE_DIVISOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-01 21:49:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( v_scroll_enabled )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											v_scroll - > scroll ( v_scroll - > get_page ( )  *  pan_gesture - > get_delta ( ) . y  /  ScrollBar : : PAGE_DIVISOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-01 21:49:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 18:53:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 06:54:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( v_scroll - > get_value ( )  ! =  prev_v_scroll  | |  h_scroll - > get_value ( )  ! =  prev_h_scroll )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											accept_event ( ) ;  // Accept event if scroll changed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 00:36:31 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : _update_scrollbar_position ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-09-03 14:22:16 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! _updating_scrollbars )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  right_margin  =  theme_cache . panel_style - > get_margin ( SIDE_RIGHT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  left_margin  =  theme_cache . panel_style - > get_margin ( SIDE_LEFT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  top_margin  =  theme_cache . panel_style - > get_margin ( SIDE_TOP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  bottom_margin  =  theme_cache . panel_style - > get_margin ( SIDE_BOTTOM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( draw_focus_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Only update margins if the focus style's margins don't fit into the panel style's margins.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  focus_margin  =  theme_cache . focus_style - > get_margin ( SIDE_RIGHT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_margin  >  right_margin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											right_margin  + =  focus_margin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										focus_margin  =  theme_cache . focus_style - > get_margin ( SIDE_LEFT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_margin  >  left_margin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											left_margin  + =  focus_margin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										focus_margin  =  theme_cache . focus_style - > get_margin ( SIDE_TOP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_margin  >  top_margin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											top_margin  + =  focus_margin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										focus_margin  =  theme_cache . focus_style - > get_margin ( SIDE_BOTTOM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_margin  >  bottom_margin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bottom_margin  + =  focus_margin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-19 14:57:50 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  hmin  =  h_scroll - > is_visible ( )  ?  h_scroll - > get_combined_minimum_size ( )  :  Size2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  vmin  =  v_scroll - > is_visible ( )  ?  v_scroll - > get_combined_minimum_size ( )  :  Size2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  lmar  =  is_layout_rtl ( )  ?  right_margin  :  left_margin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  rmar  =  is_layout_rtl ( )  ?  left_margin  :  right_margin ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 00:36:31 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-19 14:57:50 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									h_scroll - > set_anchor_and_offset ( SIDE_LEFT ,  ANCHOR_BEGIN ,  lmar ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									h_scroll - > set_anchor_and_offset ( SIDE_RIGHT ,  ANCHOR_END ,  - rmar  -  vmin . width ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									h_scroll - > set_anchor_and_offset ( SIDE_TOP ,  ANCHOR_END ,  - hmin . height  -  bottom_margin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									h_scroll - > set_anchor_and_offset ( SIDE_BOTTOM ,  ANCHOR_END ,  - bottom_margin ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 00:36:31 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-19 14:57:50 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v_scroll - > set_anchor_and_offset ( SIDE_LEFT ,  ANCHOR_END ,  - vmin . width  -  rmar ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v_scroll - > set_anchor_and_offset ( SIDE_RIGHT ,  ANCHOR_END ,  - rmar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v_scroll - > set_anchor_and_offset ( SIDE_TOP ,  ANCHOR_BEGIN ,  top_margin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v_scroll - > set_anchor_and_offset ( SIDE_BOTTOM ,  ANCHOR_END ,  - hmin . height  -  bottom_margin ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 00:36:31 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-03 14:22:16 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_updating_scrollbars  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 00:36:31 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-14 21:19:23 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : _gui_focus_changed ( Control  * p_control )  {  
						 
					
						
							
								
									
										
										
										
											2021-06-18 16:02:50 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( follow_focus  & &  is_ancestor_of ( p_control ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-14 21:19:23 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ensure_control_visible ( p_control ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-24 00:03:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 14:30:07 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( draw_focus_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  bool  _should_draw_focus_border  =  has_focus ( )  | |  child_has_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_border_is_drawn  ! =  _should_draw_focus_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-14 21:19:23 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-12-24 00:03:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-14 21:19:23 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : ensure_control_visible ( Control  * p_control )  {  
						 
					
						
							
								
									
										
										
										
											2021-06-18 16:02:50 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_MSG ( ! is_ancestor_of ( p_control ) ,  " Must be an ancestor of the control. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-11 14:29:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-16 12:36:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Just eliminate the rotation of this ScrollContainer.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Transform2D  other_in_this  =  get_global_transform ( ) . affine_inverse ( )  *  p_control - > get_global_transform ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  size  =  get_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Rect2  other_rect  =  other_in_this . xform ( Rect2 ( Point2 ( ) ,  p_control - > get_size ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-07-22 14:25:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  side_margin  =  v_scroll - > is_visible ( )  ?  v_scroll - > get_size ( ) . x  :  0.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-14 21:19:23 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  bottom_margin  =  h_scroll - > is_visible ( )  ?  h_scroll - > get_size ( ) . y  :  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-16 12:36:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector2  diff  =  Vector2 ( MAX ( MIN ( other_rect . position . x  -  ( is_layout_rtl ( )  ?  side_margin  :  0.0f ) ,  0.0f ) ,  other_rect . position . x  +  other_rect . size . x  -  size . x  +  ( ! is_layout_rtl ( )  ?  side_margin  :  0.0f ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MAX ( MIN ( other_rect . position . y ,  0.0f ) ,  other_rect . position . y  +  other_rect . size . y  -  size . y  +  bottom_margin ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-14 21:19:23 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-16 12:36:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_h_scroll ( get_h_scroll ( )  +  diff . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_v_scroll ( get_v_scroll ( )  +  diff . y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-11 14:29:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : _reposition_children ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_scrollbars ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  size  =  get_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Point2  ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  panel_size  =  theme_cache . panel_style - > get_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Point2  panel_offset  =  theme_cache . panel_style - > get_offset ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									size  - =  panel_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ofs  + =  panel_offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( draw_focus_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Only update the size and offset if focus style's doesn't fit into the panel style's.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Size2  focus_size  =  theme_cache . focus_style - > get_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_size  >  panel_size )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											size  - =  focus_size  -  panel_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Point2  focus_offset  =  theme_cache . focus_style - > get_offset ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_offset  >  panel_offset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ofs  + =  focus_offset  -  panel_offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  rtl  =  is_layout_rtl ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( _is_h_scroll_visible ( )  | |  horizontal_scroll_mode  = =  SCROLL_MODE_RESERVE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										size . y  - =  h_scroll - > get_minimum_size ( ) . y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( _is_v_scroll_visible ( )  | |  vertical_scroll_mode  = =  SCROLL_MODE_RESERVE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										size . x  - =  v_scroll - > get_minimum_size ( ) . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  get_child_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-06 12:38:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Control  * c  =  as_sortable_control ( get_child ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! c )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( c  = =  h_scroll  | |  c  = =  v_scroll  | |  c  = =  focus_panel )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Size2  minsize  =  c - > get_combined_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-04-18 14:38:44 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Rect2  r  =  Rect2 ( - Size2 ( get_h_scroll ( ) ,  get_v_scroll ( ) ) ,  minsize ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-07 20:37:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( c - > get_h_size_flags ( ) . has_flag ( SIZE_EXPAND ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											r . size . width  =  MAX ( size . width ,  minsize . width ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-07 20:37:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( c - > get_v_size_flags ( ) . has_flag ( SIZE_EXPAND ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											r . size . height  =  MAX ( size . height ,  minsize . height ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										r . position  + =  ofs ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( rtl  & &  _is_v_scroll_visible ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											r . position . x  + =  v_scroll - > get_minimum_size ( ) . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										r . position  =  r . position . floor ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fit_child_in_rect ( c ,  r ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( draw_focus_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										focus_panel - > set_size ( get_size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-29 10:51:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : _accessibility_action_scroll_set ( const  Variant  & p_data )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Point2  & pos  =  p_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									h_scroll - > set_value ( pos . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v_scroll - > set_value ( pos . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : _accessibility_action_scroll_up ( const  Variant  & p_data )  {  
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v_scroll - > set_value ( v_scroll - > get_value ( )  -  v_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : _accessibility_action_scroll_down ( const  Variant  & p_data )  {  
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v_scroll - > set_value ( v_scroll - > get_value ( )  +  v_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : _accessibility_action_scroll_left ( const  Variant  & p_data )  {  
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									h_scroll - > set_value ( h_scroll - > get_value ( )  -  h_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : _accessibility_action_scroll_right ( const  Variant  & p_data )  {  
						 
					
						
							
								
									
										
										
										
											2025-04-18 07:27:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									h_scroll - > set_value ( h_scroll - > get_value ( )  +  h_scroll - > get_page ( )  /  ScrollBar : : PAGE_DIVISOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 16:42:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ACCESSIBILITY_UPDATE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RID  ae  =  get_accessibility_element ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_COND ( ae . is_null ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_set_role ( ae ,  DisplayServer : : AccessibilityRole : : ROLE_SCROLL_VIEW ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_add_action ( ae ,  DisplayServer : : AccessibilityAction : : ACTION_SCROLL_DOWN ,  callable_mp ( this ,  & ScrollContainer : : _accessibility_action_scroll_down ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_add_action ( ae ,  DisplayServer : : AccessibilityAction : : ACTION_SCROLL_LEFT ,  callable_mp ( this ,  & ScrollContainer : : _accessibility_action_scroll_left ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_add_action ( ae ,  DisplayServer : : AccessibilityAction : : ACTION_SCROLL_RIGHT ,  callable_mp ( this ,  & ScrollContainer : : _accessibility_action_scroll_right ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_add_action ( ae ,  DisplayServer : : AccessibilityAction : : ACTION_SCROLL_UP ,  callable_mp ( this ,  & ScrollContainer : : _accessibility_action_scroll_up ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > accessibility_update_add_action ( ae ,  DisplayServer : : AccessibilityAction : : ACTION_SET_SCROLL_OFFSET ,  callable_mp ( this ,  & ScrollContainer : : _accessibility_action_scroll_set ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_LAYOUT_DIRECTION_CHANGED : 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_TRANSLATION_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_updating_scrollbars  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-19 14:57:50 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											callable_mp ( this ,  is_ready ( )  ?  & ScrollContainer : : _reposition_children  :  & ScrollContainer : : _update_scrollbar_position ) . call_deferred ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-10 18:10:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p_what  = =  NOTIFICATION_THEME_CHANGED )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												scroll_border  =  get_theme_constant ( SNAME ( " scroll_border " ) ,  SNAME ( " Tree " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												scroll_speed  =  get_theme_constant ( SNAME ( " scroll_speed " ) ,  SNAME ( " Tree " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												focus_panel - > add_theme_style_override ( " panel " ,  theme_cache . focus_style ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-10 18:10:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_READY :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Viewport  * viewport  =  get_viewport ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:52:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ERR_FAIL_NULL ( viewport ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											viewport - > connect ( " gui_focus_changed " ,  callable_mp ( this ,  & ScrollContainer : : _gui_focus_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_reposition_children ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_SORT_CHILDREN :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_reposition_children ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAW :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-06 20:09:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											draw_style_box ( theme_cache . panel_style ,  Rect2 ( Vector2 ( ) ,  get_size ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											focus_border_is_drawn  =  draw_focus_border  & &  ( has_focus ( )  | |  child_has_focus ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											focus_panel - > set_visible ( focus_border_is_drawn ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-10 18:10:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAG_BEGIN :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( scroll_on_drag_hover  & &  is_visible_in_tree ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_process_internal ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAG_END :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											set_process_internal ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_INTERNAL_PROCESS :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( scroll_on_drag_hover  & &  get_viewport ( ) - > gui_is_dragging ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Point2  mouse_position  =  get_viewport ( ) - > get_mouse_position ( )  -  get_global_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Transform2D  xform  =  get_transform ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( Rect2 ( Point2 ( ) ,  xform . get_scale ( )  *  get_size ( ) ) . grow ( scroll_border ) . has_point ( mouse_position ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Point2  point ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ( Math : : abs ( mouse_position . x )  <  Math : : abs ( mouse_position . x  -  get_size ( ) . width ) )  & &  ( Math : : abs ( mouse_position . x )  <  scroll_border ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														point . x  =  mouse_position . x  -  scroll_border ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( Math : : abs ( mouse_position . x  -  get_size ( ) . width )  <  scroll_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														point . x  =  mouse_position . x  -  ( get_size ( ) . width  -  scroll_border ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ( Math : : abs ( mouse_position . y )  <  Math : : abs ( mouse_position . y  -  get_size ( ) . height ) )  & &  ( Math : : abs ( mouse_position . y )  <  scroll_border ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														point . y  =  mouse_position . y  -  scroll_border ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( Math : : abs ( mouse_position . y  -  get_size ( ) . height )  <  scroll_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														point . y  =  mouse_position . y  -  ( get_size ( ) . height  -  scroll_border ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													point  * =  scroll_speed  *  get_process_delta_time ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													point  + =  Point2 ( get_h_scroll ( ) ,  get_v_scroll ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h_scroll - > set_value ( point . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													v_scroll - > set_value ( point . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( drag_touching )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( drag_touching_deaccel )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Vector2  pos  =  Vector2 ( h_scroll - > get_value ( ) ,  v_scroll - > get_value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-11 17:14:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													pos  + =  drag_speed  *  get_process_delta_time ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bool  turnoff_h  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bool  turnoff_v  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( pos . x  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														pos . x  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														turnoff_h  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( pos . x  >  ( h_scroll - > get_max ( )  -  h_scroll - > get_page ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														pos . x  =  h_scroll - > get_max ( )  -  h_scroll - > get_page ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														turnoff_h  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( pos . y  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														pos . y  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														turnoff_v  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( pos . y  >  ( v_scroll - > get_max ( )  -  v_scroll - > get_page ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														pos . y  =  v_scroll - > get_max ( )  -  v_scroll - > get_page ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														turnoff_v  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( horizontal_scroll_mode  ! =  SCROLL_MODE_DISABLED )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-21 19:10:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														h_scroll - > scroll_to ( pos . x ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( vertical_scroll_mode  ! =  SCROLL_MODE_DISABLED )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-21 19:10:28 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														v_scroll - > scroll_to ( pos . y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  sgn_x  =  drag_speed . x  <  0  ?  - 1  :  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  val_x  =  Math : : abs ( drag_speed . x ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-11 17:14:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													val_x  - =  1000  *  get_process_delta_time ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( val_x  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														turnoff_h  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  sgn_y  =  drag_speed . y  <  0  ?  - 1  :  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  val_y  =  Math : : abs ( drag_speed . y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-11 17:14:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													val_y  - =  1000  *  get_process_delta_time ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( val_y  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														turnoff_v  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													drag_speed  =  Vector2 ( sgn_x  *  val_x ,  sgn_y  *  val_y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( turnoff_h  & &  turnoff_v )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														_cancel_drag ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( time_since_motion  = =  0  | |  time_since_motion  >  0.1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Vector2  diff  =  drag_accum  -  last_drag_accum ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														last_drag_accum  =  drag_accum ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-11 17:14:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														drag_speed  =  diff  /  get_process_delta_time ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-04-11 17:14:25 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													time_since_motion  + =  get_process_delta_time ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 18:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : update_scrollbars ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  size  =  get_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  panel_size  =  theme_cache . panel_style - > get_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									size  - =  panel_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( draw_focus_border )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Size2  focus_size  =  theme_cache . focus_style - > get_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Only update the size if the focus style's minimum size doesn't fit into the panel style's minimum size.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( focus_size  >  panel_size )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											size  - =  focus_size  -  panel_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Size2  hmin  =  h_scroll - > get_combined_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  vmin  =  v_scroll - > get_combined_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									h_scroll - > set_visible ( horizontal_scroll_mode  = =  SCROLL_MODE_SHOW_ALWAYS  | |  ( ( horizontal_scroll_mode  = =  SCROLL_MODE_AUTO  | |  horizontal_scroll_mode  = =  SCROLL_MODE_RESERVE )  & &  largest_child_min_size . width  >  size . width ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v_scroll - > set_visible ( vertical_scroll_mode  = =  SCROLL_MODE_SHOW_ALWAYS  | |  ( ( vertical_scroll_mode  = =  SCROLL_MODE_AUTO  | |  vertical_scroll_mode  = =  SCROLL_MODE_RESERVE )  & &  largest_child_min_size . height  >  size . height ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									h_scroll - > set_max ( largest_child_min_size . width ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									h_scroll - > set_page ( _is_v_scroll_visible ( )  ?  size . width  -  vmin . width  :  size . width ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-01 18:31:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-23 20:53:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v_scroll - > set_max ( largest_child_min_size . height ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v_scroll - > set_page ( _is_h_scroll_visible ( )  ?  size . height  -  hmin . height  :  size . height ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-14 18:19:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Avoid scrollbar overlapping.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-19 14:57:50 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_updating_scrollbars  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									callable_mp ( this ,  & ScrollContainer : : _update_scrollbar_position ) . call_deferred ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : _scroll_moved ( float )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									queue_sort ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-04-18 14:38:44 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : set_h_scroll ( int  p_pos )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									h_scroll - > set_value ( p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_cancel_drag ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  ScrollContainer : : get_h_scroll ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  h_scroll - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : set_v_scroll ( int  p_pos )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v_scroll - > set_value ( p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_cancel_drag ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  ScrollContainer : : get_v_scroll ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  v_scroll - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-03 10:36:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : set_horizontal_custom_step ( float  p_custom_step )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									h_scroll - > set_custom_step ( p_custom_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								float  ScrollContainer : : get_horizontal_custom_step ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  h_scroll - > get_custom_step ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : set_vertical_custom_step ( float  p_custom_step )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v_scroll - > set_custom_step ( p_custom_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								float  ScrollContainer : : get_vertical_custom_step ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  v_scroll - > get_custom_step ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : set_horizontal_scroll_mode ( ScrollMode  p_mode )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( horizontal_scroll_mode  = =  p_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 09:38:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									horizontal_scroll_mode  =  p_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 14:02:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									queue_sort ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ScrollContainer : : ScrollMode  ScrollContainer : : get_horizontal_scroll_mode ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  horizontal_scroll_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : set_vertical_scroll_mode ( ScrollMode  p_mode )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( vertical_scroll_mode  = =  p_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-16 09:38:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									vertical_scroll_mode  =  p_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 14:02:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									queue_sort ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ScrollContainer : : ScrollMode  ScrollContainer : : get_vertical_scroll_mode ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  vertical_scroll_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  ScrollContainer : : get_deadzone ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  deadzone ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : set_deadzone ( int  p_deadzone )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									deadzone  =  p_deadzone ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-24 00:03:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  ScrollContainer : : is_following_focus ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  follow_focus ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-30 23:42:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : set_follow_focus ( bool  p_follow )  {  
						 
					
						
							
								
									
										
										
										
											2019-12-24 00:03:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									follow_focus  =  p_follow ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-17 19:03:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PackedStringArray  ScrollContainer : : get_configuration_warnings ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PackedStringArray  warnings  =  Container : : get_configuration_warnings ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 23:59:27 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-09 15:50:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  found  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  get_child_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-19 00:33:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Control  * c  =  as_sortable_control ( get_child ( i ) ,  SortableVisibilityMode : : VISIBLE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! c )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-09 15:50:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( c  = =  h_scroll  | |  c  = =  v_scroll  | |  c  = =  focus_panel )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-09 15:50:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-09 15:50:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										found + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( found  ! =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-28 15:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										warnings . push_back ( RTR ( " ScrollContainer is intended to work with a single child control. \n Use a container as child (VBox, HBox, etc.), or a Control and set the custom minimum size manually. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-29 05:01:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  warnings ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-09 15:50:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-10 18:10:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : set_scroll_on_drag_hover ( bool  p_scroll )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scroll_on_drag_hover  =  p_scroll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 13:46:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HScrollBar  * ScrollContainer : : get_h_scroll_bar ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  h_scroll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 13:46:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								VScrollBar  * ScrollContainer : : get_v_scroll_bar ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  v_scroll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  ScrollContainer : : _bind_methods ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-01-17 10:43:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_h_scroll " ,  " value " ) ,  & ScrollContainer : : set_h_scroll ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-13 12:47:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_h_scroll " ) ,  & ScrollContainer : : get_h_scroll ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-18 14:38:44 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 10:43:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_v_scroll " ,  " value " ) ,  & ScrollContainer : : set_v_scroll ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-13 12:47:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_v_scroll " ) ,  & ScrollContainer : : get_v_scroll ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-18 14:38:44 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-03 10:36:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_horizontal_custom_step " ,  " value " ) ,  & ScrollContainer : : set_horizontal_custom_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_horizontal_custom_step " ) ,  & ScrollContainer : : get_horizontal_custom_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_vertical_custom_step " ,  " value " ) ,  & ScrollContainer : : set_vertical_custom_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_vertical_custom_step " ) ,  & ScrollContainer : : get_vertical_custom_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_horizontal_scroll_mode " ,  " enable " ) ,  & ScrollContainer : : set_horizontal_scroll_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_horizontal_scroll_mode " ) ,  & ScrollContainer : : get_horizontal_scroll_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-18 14:38:44 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_vertical_scroll_mode " ,  " enable " ) ,  & ScrollContainer : : set_vertical_scroll_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_vertical_scroll_mode " ) ,  & ScrollContainer : : get_vertical_scroll_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-18 14:38:44 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_deadzone " ,  " deadzone " ) ,  & ScrollContainer : : set_deadzone ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_deadzone " ) ,  & ScrollContainer : : get_deadzone ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-18 14:38:44 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-24 00:03:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_follow_focus " ,  " enabled " ) ,  & ScrollContainer : : set_follow_focus ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " is_following_focus " ) ,  & ScrollContainer : : is_following_focus ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 13:46:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_h_scroll_bar " ) ,  & ScrollContainer : : get_h_scroll_bar ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_v_scroll_bar " ) ,  & ScrollContainer : : get_v_scroll_bar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-14 21:19:23 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " ensure_control_visible " ,  " control " ) ,  & ScrollContainer : : ensure_control_visible ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 14:30:07 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " set_draw_focus_border " ,  " draw " ) ,  & ScrollContainer : : set_draw_focus_border ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_draw_focus_border " ) ,  & ScrollContainer : : get_draw_focus_border ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " scroll_started " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " scroll_ended " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-24 00:03:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " follow_focus " ) ,  " set_follow_focus " ,  " is_following_focus " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 14:30:07 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : BOOL ,  " draw_focus_border " ) ,  " set_draw_focus_border " ,  " get_draw_focus_border " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-24 00:03:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_GROUP ( " Scroll " ,  " scroll_ " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-20 00:24:41 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " scroll_horizontal " ,  PROPERTY_HINT_NONE ,  " suffix:px " ) ,  " set_h_scroll " ,  " get_h_scroll " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " scroll_vertical " ,  PROPERTY_HINT_NONE ,  " suffix:px " ) ,  " set_v_scroll " ,  " get_v_scroll " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-03 10:36:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : FLOAT ,  " scroll_horizontal_custom_step " ,  PROPERTY_HINT_RANGE ,  " -1,4096,suffix:px " ) ,  " set_horizontal_custom_step " ,  " get_horizontal_custom_step " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : FLOAT ,  " scroll_vertical_custom_step " ,  PROPERTY_HINT_RANGE ,  " -1,4096,suffix:px " ) ,  " set_vertical_custom_step " ,  " get_vertical_custom_step " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " horizontal_scroll_mode " ,  PROPERTY_HINT_ENUM ,  " Disabled,Auto,Always Show,Never Show,Reserve " ) ,  " set_horizontal_scroll_mode " ,  " get_horizontal_scroll_mode " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " vertical_scroll_mode " ,  PROPERTY_HINT_ENUM ,  " Disabled,Auto,Always Show,Never Show,Reserve " ) ,  " set_vertical_scroll_mode " ,  " get_vertical_scroll_mode " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_PROPERTY ( PropertyInfo ( Variant : : INT ,  " scroll_deadzone " ) ,  " set_deadzone " ,  " get_deadzone " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SCROLL_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SCROLL_MODE_AUTO ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SCROLL_MODE_SHOW_ALWAYS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SCROLL_MODE_SHOW_NEVER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-11 20:50:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_ENUM_CONSTANT ( SCROLL_MODE_RESERVE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-08 21:00:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_THEME_ITEM_CUSTOM ( Theme : : DATA_TYPE_STYLEBOX ,  ScrollContainer ,  panel_style ,  " panel " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 14:30:07 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BIND_THEME_ITEM_CUSTOM ( Theme : : DATA_TYPE_STYLEBOX ,  ScrollContainer ,  focus_style ,  " focus " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-08 21:00:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									GLOBAL_DEF ( " gui/common/default_scroll_deadzone " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 14:30:07 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ScrollContainer : : set_draw_focus_border ( bool  p_draw )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( draw_focus_border  = =  p_draw )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									draw_focus_border  =  p_draw ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( is_ready ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_reposition_children ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 14:30:07 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  ScrollContainer : : get_draw_focus_border ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  draw_focus_border ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  ScrollContainer : : child_has_focus ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Control  * focus_owner  =  get_viewport ( )  ?  get_viewport ( ) - > gui_get_focus_owner ( )  :  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  focus_owner  & &  is_ancestor_of ( focus_owner ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								ScrollContainer : : ScrollContainer ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									h_scroll  =  memnew ( HScrollBar ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									h_scroll - > set_name ( " _h_scroll " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 15:49:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_child ( h_scroll ,  false ,  INTERNAL_MODE_BACK ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									h_scroll - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & ScrollContainer : : _scroll_moved ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v_scroll  =  memnew ( VScrollBar ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v_scroll - > set_name ( " _v_scroll " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-25 15:49:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_child ( v_scroll ,  false ,  INTERNAL_MODE_BACK ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v_scroll - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & ScrollContainer : : _scroll_moved ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-18 00:02:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// We need to use a PanelContainer for the focus style instead of just drawing it directly with RenderingService
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// due to a clippling issues. The Control that is being scrolled will be over the focus border because both will be
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// drawn on the same CanvasItem. If we decide to ignore clipping, the focus border will be drawn even over other
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// CanvasItems.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									focus_panel  =  memnew ( PanelContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									focus_panel - > set_name ( " _focus " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									focus_panel - > set_mouse_filter ( MOUSE_FILTER_IGNORE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									focus_panel - > set_focus_mode ( FOCUS_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									focus_panel - > set_visible ( draw_focus_border ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( focus_panel ,  false ,  INTERNAL_MODE_BACK ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-27 22:37:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									deadzone  =  GLOBAL_GET ( " gui/common/default_scroll_deadzone " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-09 15:50:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_clip_contents ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}