This project is read-only.

ZoomCanvas limiting min and max scale

Sep 14, 2010 at 4:34 PM


First I would like to thank you for Blake.NUI. It helped us a lot. :)
Secondly I would like know if there is a was to limit scaling or size.
ViewMatrix and ViewScale are both readonly I don't see a was to change them.

Sep 14, 2010 at 4:46 PM


Thanks for the feedback.

For the ZoomCanvas, you can make a custom IZoomCanvasInputAdapter. Start out by copying the ZoomCanvasInputAdapterTouch.cs.

Notice in RegisterZoomCanvas you are given reference to the ZoomCanvas. You can save this reference and then in the manipulation events, check the scale, center, or rotation and modify the manipulation delta values you send to the ManipulationDelta event. For example, if the current scale plus the delta scale would go past your threshold, set the delta scale to 0.

You can also use the SetState event to make the ZoomCanvas go to a specific state.

This is a little bit hacky but will get you started right now. I'll add optional limits for scale, center, and rotation to the list of features to work on.

Can you tell me more about how you are using Blake.NUI?



Sep 16, 2010 at 9:08 AM
Edited Sep 16, 2010 at 9:10 AM


Sorry for late responce.

I made a copy of ZoomCanvasInputAdapterTouch and made some changes in manipulation delta callback method and it works like charm. :)
I also added elastic boundary for some fancyeffects when manipulation is over.

We are using Blake.NUI to build Windows 7/Surface application for display a mini map.
We are also considering to port other Surface projects to Blake.NUI. :)

 Before Blake.NUI I had to build to two separated projects for controls and GUI while Surface projects were developt in Virtual Machine because I have x64 OS.
Now I can develop for both at same time without Virtual PC.


Sep 23, 2010 at 3:40 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.