I compare pan with right button in sample Multi Mouse Buttons and pan with left button in sample Basic. In sample Multi Mouse Buttons image not follow mouse if zoom level is bigger. In sample Basic this work fine.
Could you please check this.
You are right.
The values that are passed to the Translate method should not be multiplied by the actualViewboxSize. So instead of:
dx = (newMousePosition.X - _lastMoveMousePosition.X) * actualViewboxSize.Width;
dy = (newMousePosition.Y - _lastMoveMousePosition.Y) * actualViewboxSize.Height;
It should be:
dx = (newMousePosition.X - _lastMoveMousePosition.X);
dy = (newMousePosition.Y - _lastMoveMousePosition.Y);
After the change the ZoomPanelMultiMouseButtonSample_MouseMove method should be:
void ZoomPanelMultiMouseButtonSample_MouseMove(object sender, MouseEventArgs e)
// Only process mouse move when we are moving the content with right mouse button
if (ZoomPanel1.ZoomMode != Ab2d.Controls.ZoomPanel.ZoomModeType.Move || e.RightButton != MouseButtonState.Pressed)
Point newMousePosition = e.GetPosition(ZoomPanel1);
// Calculate dx and dy and take the current zoom ration in account
double dx = (newMousePosition.X - _lastMoveMousePosition.X);
double dy = (newMousePosition.Y - _lastMoveMousePosition.Y);
// Disable animation and make the transition
ZoomPanel1.IsAnimated = false;
ZoomPanel1.IsAnimated = true;
_lastMoveMousePosition = newMousePosition;
e.Handled = true;