mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	FIX: scroll offset with touch pad
Change-Id: I7dbec590f39f174c02e4179fd781ff7fd1a93374
This commit is contained in:
		
							parent
							
								
									fee419797d
								
							
						
					
					
						commit
						3b3ad1b390
					
				
					 4 changed files with 15 additions and 11 deletions
				
			
		|  | @ -368,14 +368,17 @@ void ImageGrid::resize(wxSizeEvent& event) | |||
| 
 | ||||
| void ImageGrid::mouseWheelMoved(wxMouseEvent &event) | ||||
| { | ||||
|     auto delta = event.GetWheelRotation() < 0 ? 1 : -1; | ||||
|     int off = m_row_offset + delta; | ||||
|     if (off >= 0 && off < m_row_count) { | ||||
|         m_row_offset = off; | ||||
|         m_timer.StartOnce(4000); // Show position bar
 | ||||
|         UpdateFocusRange(); | ||||
|         Refresh(); | ||||
|     } | ||||
|     auto delta = -event.GetWheelRotation(); | ||||
|     m_scroll_offset += delta; | ||||
|     int max = m_row_count * m_cell_size.GetHeight() / 4; | ||||
|     if (m_scroll_offset < 0) | ||||
|         m_scroll_offset = 0; | ||||
|     else if (m_scroll_offset >= max) | ||||
|         m_scroll_offset = max - 1; | ||||
|     m_row_offset = m_scroll_offset * 4 / m_cell_size.GetHeight(); | ||||
|     m_timer.StartOnce(4000); // Show position bar
 | ||||
|     UpdateFocusRange(); | ||||
|     Refresh(); | ||||
| } | ||||
| 
 | ||||
| void Slic3r::GUI::ImageGrid::changedEvent(wxCommandEvent& evt) | ||||
|  |  | |||
|  | @ -122,6 +122,7 @@ private: | |||
|     int     m_hit_type = HIT_NONE; | ||||
|     size_t  m_hit_item = size_t(-1); | ||||
| 
 | ||||
|     int m_scroll_offset = 0; | ||||
|     int m_row_offset = 0; // 1/4 row height
 | ||||
|     int m_row_count = 0; // 1/4 row height
 | ||||
|     int m_col_count = 1; | ||||
|  |  | |||
|  | @ -432,7 +432,7 @@ void DropDown::mouseMove(wxMouseEvent &event) | |||
| 
 | ||||
| void DropDown::mouseWheelMoved(wxMouseEvent &event) | ||||
| { | ||||
|     auto delta = event.GetWheelRotation() > 0 ? rowSize.y : -rowSize.y; | ||||
|     auto delta = event.GetWheelRotation(); | ||||
|     wxPoint pt2 = offset + wxPoint{0, delta}; | ||||
|     if (pt2.y > 0) | ||||
|         pt2.y = 0; | ||||
|  |  | |||
|  | @ -110,7 +110,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url) | |||
|         webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Windows NT 10.0; Win64; x64) " | ||||
|             "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52", SLIC3R_VERSION,  | ||||
|             Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light")); | ||||
|         webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize); | ||||
|         webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); | ||||
|         // We register the wxfs:// protocol for testing purposes
 | ||||
|         webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("bbl"))); | ||||
|         // And the memory: file system
 | ||||
|  | @ -120,7 +120,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url) | |||
|         webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs"))); | ||||
|         // And the memory: file system
 | ||||
|         webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory"))); | ||||
|         webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize); | ||||
|         webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE); | ||||
|         webView->SetUserAgent(wxString::Format("BBL-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION, | ||||
|                                                Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light")); | ||||
| #endif | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 chunmao.guo
						chunmao.guo