mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-20 07:22:35 +00:00
Sketch: open the dimension field on the right monitor, and stop it freezing the view
Ports snaporca-cad c741fb9677. SketchInlineEditor::open() clamped its position with wxGetClientDisplayRect(), which describes only the PRIMARY monitor. On a multi-head desktop (the reporting machine runs 5760x1080 across screens at +0, +1920 and +3840) a field anchored on the left or right screen was clamped onto the middle one and left invisible, while m_awaiting_length made the sketch tool consume every mouse event until it was answered: orbit and pan died after any sketch, with Enter the only way out. Clamp to the display the anchor is actually on instead. Also let drags and the wheel through that freeze, so a field that lands somewhere unexpected degrades to odd placement rather than a dead viewport. Both files were byte-identical between the forks apart from this change, so they are copied verbatim. Verified on the snaporca side by the user; this fork is still uncompiled (needs Eigen 5.0.1, which the available deps image does not provide). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVzKmX6Y1aEteit1HTXG4Q
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b3e7d65cca
commit
7858cd6b6a
@@ -7403,6 +7403,11 @@ bool DesignSketchTool::on_mouse(wxMouseEvent& evt, GLCanvas3D& canvas)
|
||||
// so the Polyline handler ends the chain. Without this the freeze ate every terminator.
|
||||
if (m_mode == Mode::Polyline && (evt.RightDown() || evt.LeftDClick()) && on_inline_dismiss)
|
||||
on_inline_dismiss(); // -> set_inline_busy(false), m_awaiting_length=false
|
||||
// The freeze exists so a stray click can't draw under the floating field — it was
|
||||
// never meant to trap the camera. Let drags and the wheel through, so a field that
|
||||
// opens somewhere unexpected can't leave the viewport unusable.
|
||||
else if (evt.Dragging() || evt.GetWheelRotation() != 0)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "SketchInlineEditor.hpp"
|
||||
|
||||
#include <wx/display.h>
|
||||
|
||||
#include <wx/frame.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/stattext.h>
|
||||
@@ -83,7 +85,15 @@ void SketchInlineEditor::open(const wxPoint& screen_px, double value,
|
||||
wxPoint pos(screen_px.x - sz.GetWidth() / 2, screen_px.y - sz.GetHeight() / 2);
|
||||
// Keep the frame fully on-screen: an anchor that maps off the display makes GTK drop
|
||||
// the window at a default corner (top-left) instead of the requested point.
|
||||
const wxRect area = wxGetClientDisplayRect();
|
||||
// Clamp to the display the anchor is ON, not the primary one: wxGetClientDisplayRect()
|
||||
// only ever describes the primary monitor, so on a multi-head desktop it shoved this
|
||||
// field onto a different screen than the app. It then sat invisible while
|
||||
// m_awaiting_length made the sketch tool eat every mouse event, which read as the
|
||||
// viewport freezing after a sketch with only Enter able to release it.
|
||||
int disp = wxDisplay::GetFromPoint(screen_px);
|
||||
if (disp == wxNOT_FOUND) disp = wxDisplay::GetFromWindow(m_frame);
|
||||
const wxRect area = (disp != wxNOT_FOUND) ? wxDisplay(unsigned(disp)).GetClientArea()
|
||||
: wxGetClientDisplayRect();
|
||||
pos.x = std::max(area.GetLeft(), std::min(pos.x, area.GetRight() - sz.GetWidth()));
|
||||
pos.y = std::max(area.GetTop(), std::min(pos.y, area.GetBottom() - sz.GetHeight()));
|
||||
// Show() BEFORE Move(): GTK ignores a Move() issued before the window is mapped (the
|
||||
|
||||
Reference in New Issue
Block a user