SetZoom does not work when already zoomed in or panned
I am using code from the example you created for panning and zooming to a specific object which works fine when you are zoomed all the way out. Once you are zoomed in or panned at all, the method does not do anything. I tested to make sure it wasn't the values I was giving it, which were the same whether it was zoomed in or not. I haven't been able to test using the example you posted because I get errors when trying to run it.
The sample works great on my machine.

Can you please place a breakpoint to the call to SetZoom method and write me some more details about the parameters values that are used to call the method.
Andrej Benedik
I tried putting your sample code into the sample project and running it to see if it had anything to do with my code, but I could not get it to run. Can you send me your copy of the updated sample project with the zoom to object feature in it?

In my project, here is the first call to setzoom:

SitePlanViewer.SetZoom(centerPosition, ZoomPanel.CenterPositionUnitsType.Absolute, zoomFactor, rotationAngle);
centerPosition: {1111.609375,1929.80932617188}
zoomFactor: 21.631487461222033
rotationAngle: 159.6432

That call works fine. The second call occurs after i select the object next to it:

centerPosition: {1059.41201782227,1911.49597167969}
zoomFactor: 21.504309541034498
rotationAngle: 161.7519

This one seems to have no effect at all.
Please create a new WPF application project, add reference to ZoomPanel and copy and paste the xaml and cs code from the previous post ( Now replace Page into Window and start the project.

The sample shows that the SetZoom method works and that the title of this thread is not correct.

I do not know what changes you did to your code so I cannot say what could be wrong.
Andrej Benedik
I created a new project, referenced ZoomPanel, copied the sample verbatim and only changed the code sample from a page to window and ran it. It came up with the error on startup "'NaN,NaN,1,1' is not a valid value for property 'Viewbox'." at the same time that the evaluation warning window appears. Could the evaluation copy have anything to do with it?

Forum Jump:

Users browsing this thread:
1 Guest(s)