mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Hopefully fixing the "scroll to the first selected line" issue
at the object list.
This commit is contained in:
		
							parent
							
								
									7c75081a31
								
							
						
					
					
						commit
						6bd54f0112
					
				
					 2 changed files with 7 additions and 20 deletions
				
			
		|  | @ -18,10 +18,10 @@ wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), - | |||
| #ifdef __APPLE__ | ||||
|     m_user_drawn_background = false; | ||||
| #endif /*__APPLE__*/ | ||||
|     Bind(wxEVT_PAINT, ([this](wxPaintEvent e) { repaint(); })); | ||||
|     Bind(wxEVT_LEFT_DOWN, ([this](wxMouseEvent  event) { mouse_event(event); })); | ||||
|     Bind(wxEVT_MOTION, ([this](wxMouseEvent  event) { mouse_event(event); })); | ||||
|     Bind(wxEVT_SIZE, ([this](wxSizeEvent e) { Refresh(); })); | ||||
|     Bind(wxEVT_PAINT, ([this](wxPaintEvent &/* e */) { repaint(); })); | ||||
|     Bind(wxEVT_LEFT_DOWN, ([this](wxMouseEvent &event) { mouse_event(event); })); | ||||
|     Bind(wxEVT_MOTION, ([this](wxMouseEvent &event) { mouse_event(event); })); | ||||
|     Bind(wxEVT_SIZE, ([this](wxSizeEvent & /* e */) { Refresh(); })); | ||||
| } | ||||
| void Bed_2D::repaint() | ||||
| { | ||||
|  |  | |||
|  | @ -141,6 +141,8 @@ ObjectList::ObjectList(wxWindow* parent) : | |||
| #ifdef __WXOSX__ | ||||
|     Bind(wxEVT_KEY_DOWN, &ObjectList::OnChar, this); | ||||
| #endif //__WXOSX__
 | ||||
| 
 | ||||
|     Bind(wxEVT_SIZE, ([this](wxSizeEvent &e) { this->EnsureVisible(this->GetCurrentItem()); e.Skip(); })); | ||||
| } | ||||
| 
 | ||||
| ObjectList::~ObjectList() | ||||
|  | @ -2071,23 +2073,8 @@ void ObjectList::update_selections() | |||
|      | ||||
|     select_items(sels); | ||||
| 
 | ||||
|     /* Because of ScrollLines() and GetItemRect() functions are implemented 
 | ||||
|      * only for GENERIC DataViewCtrl in current version of wxWidgets, | ||||
|      * use this part of code only for MSW  | ||||
|      */ | ||||
| #if defined(wxUSE_GENERICDATAVIEWCTRL) | ||||
|     // Scroll selected Item in the middle of an object list
 | ||||
|     if (GetSelection()) { | ||||
|         const wxRect& sel_rc = GetItemRect(GetSelection()); | ||||
|         const wxRect& main_rc = GetClientRect(); | ||||
|         if (sel_rc.GetBottom() <= main_rc.GetTop()+sel_rc.height || | ||||
|             sel_rc.GetTop() >= main_rc.GetBottom() ) | ||||
|         { | ||||
|             const wxRect& top_rc = GetItemRect(GetTopItem()); | ||||
|             ScrollLines(int((sel_rc.y - top_rc.y) / top_rc.GetHeight()) - 0.5*GetCountPerPage()); | ||||
|         } | ||||
|     } | ||||
| #endif | ||||
|     this->EnsureVisible(this->GetCurrentItem()); | ||||
| } | ||||
| 
 | ||||
| void ObjectList::update_selections_on_canvas() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv