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)
|
void ImageGrid::mouseWheelMoved(wxMouseEvent &event)
|
||||||
{
|
{
|
||||||
auto delta = event.GetWheelRotation() < 0 ? 1 : -1;
|
auto delta = -event.GetWheelRotation();
|
||||||
int off = m_row_offset + delta;
|
m_scroll_offset += delta;
|
||||||
if (off >= 0 && off < m_row_count) {
|
int max = m_row_count * m_cell_size.GetHeight() / 4;
|
||||||
m_row_offset = off;
|
if (m_scroll_offset < 0)
|
||||||
m_timer.StartOnce(4000); // Show position bar
|
m_scroll_offset = 0;
|
||||||
UpdateFocusRange();
|
else if (m_scroll_offset >= max)
|
||||||
Refresh();
|
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)
|
void Slic3r::GUI::ImageGrid::changedEvent(wxCommandEvent& evt)
|
||||||
|
|
|
@ -122,6 +122,7 @@ private:
|
||||||
int m_hit_type = HIT_NONE;
|
int m_hit_type = HIT_NONE;
|
||||||
size_t m_hit_item = size_t(-1);
|
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_offset = 0; // 1/4 row height
|
||||||
int m_row_count = 0; // 1/4 row height
|
int m_row_count = 0; // 1/4 row height
|
||||||
int m_col_count = 1;
|
int m_col_count = 1;
|
||||||
|
|
|
@ -432,7 +432,7 @@ void DropDown::mouseMove(wxMouseEvent &event)
|
||||||
|
|
||||||
void DropDown::mouseWheelMoved(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};
|
wxPoint pt2 = offset + wxPoint{0, delta};
|
||||||
if (pt2.y > 0)
|
if (pt2.y > 0)
|
||||||
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) "
|
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,
|
"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"));
|
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
|
// We register the wxfs:// protocol for testing purposes
|
||||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("bbl")));
|
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("bbl")));
|
||||||
// And the memory: file system
|
// And the memory: file system
|
||||||
|
@ -120,7 +120,7 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
||||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
|
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
|
||||||
// And the memory: file system
|
// And the memory: file system
|
||||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
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,
|
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"));
|
Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light"));
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue