Hi Walter,
A Slider by itself doesn’t specify any particular point in the Diagram, so you’ll need to calculate the point (in model coordinates) that you want to pass to that SetScaleAndPosition method.
Using the current Diagram.Panel.Position, as you are now, will tend to keep the top-left point the same. Although that depends on the size of the Diagram.Panel properties: DiagramBounds, HorizontalContentAlignment, and VerticalContentAlignment.
Hi Walter,
Actually, your code is keeping the same Diagram.Panel.Position.
What the mouse wheel is doing is calculating the desired DiagramPanel.Position so that the mouse point stays at the same model point.
My question for you is: what point in model coordinates do you want to keep the same after changing the DiagramPanel.Scale? This is not a mouse event, so there’s no mouse pointer position from which to get the model coordinates.
If you don’t like what you are doing by keeping the DiagramPanel.Position, you could try using the center point of the DiagramPanel.ViewportBounds.
Hi Walter,
Are you asking a completely different question, about the PanningTool?
About zooming, do you know about the DiagramPanel.ZoomPoint property? That might help when changing the DiagramPanel.Scale. But note that ZoomPoint is not used by the SetScaleAndPosition method, since that method takes the desired DiagramPanel.Position as an argument.