Fix Retina coordinate for stored popup menu position
This commit is contained in:
parent
ca79932d30
commit
8022c64209
3 changed files with 15 additions and 3 deletions
|
@ -4090,6 +4090,14 @@ bool GLCanvas3D::is_object_sinking(int object_idx) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::apply_retina_scale(Vec2d &screen_coordinate) const
|
||||||
|
{
|
||||||
|
#if ENABLE_RETINA_GL
|
||||||
|
double scale = static_cast<double>(m_retina_helper->get_scale_factor());
|
||||||
|
screen_coordinate *= scale;
|
||||||
|
#endif // ENABLE_RETINA_GL
|
||||||
|
}
|
||||||
|
|
||||||
bool GLCanvas3D::_is_shown_on_screen() const
|
bool GLCanvas3D::_is_shown_on_screen() const
|
||||||
{
|
{
|
||||||
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;
|
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;
|
||||||
|
|
|
@ -925,6 +925,8 @@ public:
|
||||||
|
|
||||||
bool is_object_sinking(int object_idx) const;
|
bool is_object_sinking(int object_idx) const;
|
||||||
|
|
||||||
|
void apply_retina_scale(Vec2d &screen_coordinate) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _is_shown_on_screen() const;
|
bool _is_shown_on_screen() const;
|
||||||
|
|
||||||
|
|
|
@ -4436,7 +4436,7 @@ void Plater::priv::on_right_click(RBtnEvent& evt)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q != nullptr && menu) {
|
if (q != nullptr && menu) {
|
||||||
const Vec2d& mouse_position = evt.data.first;
|
Vec2d mouse_position = evt.data.first;
|
||||||
wxPoint position(static_cast<int>(mouse_position.x()),
|
wxPoint position(static_cast<int>(mouse_position.x()),
|
||||||
static_cast<int>(mouse_position.y()));
|
static_cast<int>(mouse_position.y()));
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
@ -4444,9 +4444,11 @@ void Plater::priv::on_right_click(RBtnEvent& evt)
|
||||||
// specified (even though the position is sane).
|
// specified (even though the position is sane).
|
||||||
position = wxDefaultPosition;
|
position = wxDefaultPosition;
|
||||||
#endif
|
#endif
|
||||||
q->canvas3D()->set_popup_menu_position(mouse_position);
|
GLCanvas3D &canvas = *q->canvas3D();
|
||||||
|
canvas.apply_retina_scale(mouse_position);
|
||||||
|
canvas.set_popup_menu_position(mouse_position);
|
||||||
q->PopupMenu(menu, position);
|
q->PopupMenu(menu, position);
|
||||||
q->canvas3D()->clear_popup_menu_position();
|
canvas.clear_popup_menu_position();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue