Skip to content

Commit a47dc15

Browse files
committed
Keep points under mouse during edit operations.
NOTE: Even when the old behavior is applied, points can still drift away from the pointer with lots of moving while zooming. Is this due to the relative tracking from the initial button press position? Or just cumulative rounding errors?
1 parent 5713b2e commit a47dc15

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/graphicswin.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,12 @@ void GraphicsWindow::ZoomToMouse(double zoomMultiplyer) {
728728
double offsetRight, offsetUp;
729729
double righti, upi;
730730

731-
if (! SS.zoomCenterNav) {
731+
// Mouse edit operations currently track the pointer relative to the
732+
// initial button press position, so zoomCenterNav is ignored during edits.
733+
bool trackPointer = (pending.operation != Pending::NONE) ||
734+
(! SS.zoomCenterNav);
735+
736+
if (trackPointer) {
732737
offsetRight = offset.Dot(projRight);
733738
offsetUp = offset.Dot(projUp);
734739

@@ -745,7 +750,7 @@ void GraphicsWindow::ZoomToMouse(double zoomMultiplyer) {
745750

746751
scale *= exp(0.1823216 * zoomMultiplyer); // ln(1.2) = 0.1823216
747752

748-
if (! SS.zoomCenterNav) {
753+
if (trackPointer) {
749754
double rightf = currentMousePosition.x / scale - offsetRight;
750755
double upf = currentMousePosition.y / scale - offsetUp;
751756

0 commit comments

Comments
 (0)