This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, I'm trying to implement a zoom to selection function for diagram surface. I need the bounds of the selection user makes with mouse (bounds of the rubberband) to do this, but i couldn't find that value. How can i get it? Thanks. |
|
|
Hello ugalt I have added a MarqueeSelectBounds property to the DiagramSurface which will give you the logical bounds of the selection rectangle as the user is dragging it. This property will be available in the next nightly build. There is also a MarqueeDragCompleted event that you can listen to when the user has finished a drag-select operation. The event args also contains the final logical bounds of the rubberband. (this is already part of the DiagramSurface - no need to wait for the nightly build for this one). Handy Tip: before performing the zoom operation, it is best to check the size of the rectangle and only zoom if the rectangle is larger than a specified threshold. If the rectangle is too small, the user may have let go of the mouse by accident. You wouldn't want to zoom in too far at once. Just be aware that the selection bounds are logical values, not the pixel size of the rectangle. If you need physical bounds, you can convert the logical bounds using the DiagramSurface.GetPhysicalBounds method. Jason Fauchelle |
|
|
Hello Jason, Thank you for your answer. I am trying to implement zoom to selection function, but have some problems. First, i tried to find the zoom rate for the selection and i calculated it like that:
than i set the new zoom rate: this.ds.Zoom = ds.Zoom * zoomRate; it zooms at correct rate, but scroll positions need to be set. But i couldn't set the scroll positions, i looked for some kind of ScrollPosition property but couldn't find it on DiagramSurface or DiagramSurface.ScrollViewer or Viewport of scrollviewer. So i tried to set viewport directly like that:
but it didn't make a zoom effect at correct rate. So how can i edit the scrollPosition of diagramsurface or is there a better way to zoom selection? Thanks for your help. |
|
|
Hello ugalt The SetViewport method expects logical values. Try removing the "/ zoomRate" from the width and height and let me know if it's still not getting you the effect you want. Jason Fauchelle |
|