GdViewer behavior when zooming

Discussions about document viewing.
Post Reply
acl
Posts: 19
Joined: Wed Oct 03, 2012 7:52 am

GdViewer behavior when zooming

Post by acl » Tue Nov 13, 2012 11:54 am

We are using GdPicture 9.3.0.3 (Ultimate SDK). There are a problems with zooming in GdViewer.

First: calling ZoomIN followed by ZoomOUT should leave the view unchanged. Well it doesn't. The view is a little bit zoomed out compared to the starting point. So ZoomOUT seems to be using a larger factor than ZoomIN.

Second: centering at the mouse does not work. There is this thread and the ZoomCenterAtMousePosition property, but none of them work. I should add that the code provided by Loïc in the linked thread is terribly slow.

This is all somewhat disappointing. So I went about implementing it all myself, here is what I've come up with (code in the MouseDown event):

Code: Select all

 Dim x = viewer.GetMouseLeftInDocument
 Dim y = viewer.GetMouseTopInDocument
 If e.Button = Windows.Forms.MouseButtons.Left Then
	 viewer.Zoom = viewer.Zoom * 1.25
 ElseIf e.Button = Windows.Forms.MouseButtons.Right Then
	 viewer.Zoom = viewer.Zoom / 1.25
 End If
 viewer.SetRectCoordinatesOnDocument(x, y, 2, 2)
 viewer.CenterOnRect()
 viewer.ClearRect()

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: GdViewer behavior when zooming

Post by Loïc » Tue Nov 13, 2012 3:38 pm

Hello,
First: calling ZoomIN followed by ZoomOUT should leave the view unchanged
No, you are wrong. See the ZoomStep property to get information about the expected behavior in GdViewer.
Second: centering at the mouse does not work
It works like a charm. At least with our latest release. You should try it.
I should add that the code provided by Loïc in the linked thread is terribly slow.
This code should not be used since it was intended to try to mimic the "ZoomCenterAtMousePosition" property behavior. Again, please try to use the latest version. The ZoomCenterAtMousePosition feature works like it is supposed to work.

If you are looking for something else just explain what you are expecting to obtain.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests