Compare commits

..

1 Commits

Author SHA1 Message Date
Ian Chua
367047f731 fix: bambu slice hover popup disappears to fast macos 2026-05-22 19:24:06 +08:00
3 changed files with 21 additions and 9 deletions

View File

@@ -864,10 +864,10 @@ std::string GCodeWriter::_spiral_travel_to_z(double z, const Vec2d &ij_offset, c
// Determine number of segments based on Resolution // Determine number of segments based on Resolution
// -------------------------------------------------------------------- // --------------------------------------------------------------------
const double ref_resolution = 0.01; // reference resolution in mm const double ref_resolution = 0.01; // reference resolution in mm
const double ref_segments = 8.0; // reference number of segments at reference resolution const double ref_segments = 16.0; // reference number of segments at reference resolution
// number of linear segments to use for approximating the arc, clamp between 4 and 16 // number of linear segments to use for approximating the arc, clamp between 4 and 24
const int segments = std::clamp(int(std::round(ref_segments * (ref_resolution / m_resolution))), 4, 16); const int segments = std::clamp(int(std::round(ref_segments * (ref_resolution / m_resolution))), 4, 24);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
const double px = m_pos(0) - m_x_offset; // take plate offset into consideration const double px = m_pos(0) - m_x_offset; // take plate offset into consideration

View File

@@ -338,7 +338,15 @@ void FilamentGroupPopup::OnRadioBtn(int idx)
} }
} }
void FilamentGroupPopup::OnTimer(wxTimerEvent &event) { Dismiss(); } void FilamentGroupPopup::OnTimer(wxTimerEvent&)
{
if (IsMouseInPopup()) {
StartTimer();
return;
}
Dismiss();
}
void FilamentGroupPopup::Dismiss() { void FilamentGroupPopup::Dismiss() {
m_active = false; m_active = false;
@@ -348,19 +356,22 @@ void FilamentGroupPopup::Dismiss() {
void FilamentGroupPopup::OnLeaveWindow(wxMouseEvent &) void FilamentGroupPopup::OnLeaveWindow(wxMouseEvent &)
{ {
wxPoint pos = this->ScreenToClient(wxGetMousePosition()); if (this->GetScreenRect().Contains(wxGetMousePosition())) return;
if (this->GetClientRect().Contains(pos)) return;
StartTimer(); StartTimer();
} }
void FilamentGroupPopup::OnEnterWindow(wxMouseEvent &) void FilamentGroupPopup::OnEnterWindow(wxMouseEvent &)
{ {
// Ignore spurious ENTER synthesized by PopupWindow::OnMouseEvent2 on macOS. // Ignore spurious ENTER synthesized by PopupWindow::OnMouseEvent2 on macOS.
wxPoint pos = this->ScreenToClient(wxGetMousePosition()); if (!this->GetScreenRect().Contains(wxGetMousePosition())) return;
if (!this->GetClientRect().Contains(pos)) return;
ResetTimer(); ResetTimer();
} }
bool FilamentGroupPopup::IsMouseInPopup() const
{
return this->GetScreenRect().Contains(wxGetMousePosition());
}
void FilamentGroupPopup::UpdateButtonStatus(int hover_idx) void FilamentGroupPopup::UpdateButtonStatus(int hover_idx)
{ {
for (int i = 0; i < ButtonType::btCount; ++i) { for (int i = 0; i < ButtonType::btCount; ++i) {
@@ -394,4 +405,4 @@ void FilamentGroupPopup::UpdateButtonStatus(int hover_idx)
Fit(); Fit();
} }
}} // namespace Slic3r::GUI }} // namespace Slic3r::GUI

View File

@@ -36,6 +36,7 @@ private:
void OnEnterWindow(wxMouseEvent &); void OnEnterWindow(wxMouseEvent &);
void OnTimer(wxTimerEvent &event); void OnTimer(wxTimerEvent &event);
void Dismiss(); void Dismiss();
bool IsMouseInPopup() const;
void CreateBmps(); void CreateBmps();