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 added a minimap to my solution, and made it read only by setting IsReadOnly property to "True". But also I set CanOriginateNewConnections to "true" for connections. And when I move my mouse over the link at the minimap I see it active (please see attached picture). If I disable minimap (set IsEnabled to "false"), I don't see such behavior, but the minimap is not active at all at that case. And I want it enabled, because I should handle some events from it (mouse click for example). How can I solve this? Could you please help me. And one more question. Can I draw something on a minimap that wouldn't be displayed on the main surface? I would like to draw a frame that would reflect a viewport. //Dmitry |
|
|
Hello Dmitry The active connections in readonly mode is a bug. Thanks for bringing our attention to this. I've fixed this now and you can download the update through the next nightly build. The next nightly build will be available at around 1200 GMT and can be downloaded from here: http://www.mindscapehq.com/products/wpfdiagrams/nightly-builds The way that I would display a frame over the minimap is to put the minimap in a Grid, and put another visual over the top of the minimap. I would recommend creating a new custom control class to represent the viewport frame which encapsulates all the logic you will need to render the rectangle. An instance of this control would sit over the top of the minimap. The logic for rendering the frame is a little tricky, so I've attached a very simple demo to get you started. To run the sample, make sure to include a reference to your copy of the Mindscape.WpfDiagramming.Foundation.dll. I've created a ViewportFrameControl which holds all the logic for positioning the rectangle. The logic is in the UpdateFrame method which gets called whenever the viewport of either the main DiagramSurface or the minimap changes. This method uses simple operations to convert between logical and pixel positions. The xaml for this control can be found in App.xaml. Note that this is a very simple implementation. As a suggestion: Rather than manipulating the Rectangle directly in the UpdateFrame method, you should set some properties with the resulting values. Then the xaml should include code to read these properties and position the rectangle or other visuals. This will make it more flexible to explore different frame styles. The frame control is being used at the end of MainWindow.xaml. I put the frame control over the top of the minimap, and set the MainDiagramSurface and Minimap properties. Let me know if you need any help when you come to implement this in your application. Jason Fauchelle |
|
|
Hello Jason! Thank you, but seems the nightly build is not ready for today, I see only build for 22 May. The demo with ViewportFrame is great! Thank you very much! But I faced with some strange behavior. Sometimes when I place a node on a surface, I see that it displayed on the minimap incorrectly (please see the attached picture) - the node is not in the center of the minimap. Could you please take a look at this? Is it a bug? //Dmitry |
|
|
Hello Dmitry Yes, there has been a slight offset bug in the center viewport logic for a while. I've resolved this now which you can get through the next nightly build. The build date may not seem right due to the time zone you are in. The build itself should be the latest update. Download the next nightly build which will contain this center-viewport fix plus yesterdays bug fix. Let me know if a bug is not fixed after you install and we'll look into it :) Jason Fauchelle |
|
|
Hello Jason Bug with active links is fixed, but I see one strange moment - if I click on a link on the minimap - no event happens. And if I click on a node - it's Ok. I would like the mini map acts as a bitmap - just possibility to handle events, no other activity. Fix for the viewport logic bug seems is not in the latest build yet, because I don't see it is fixed (please see diagram3.jpg). I'll try it next day. And also mini map works incorrectly when I apply any layout algorithm (see diagram1.jpg and diagram2.jpg). But it may be the same bug, I don't know. //Dmitry |
|
|
Hello Dmitry Just to clarify, do you want events to be raised from the minimap when clicking on a link? If so, what event are you looking for? a mouse down event or selection event? etc. What event are you listening for minimap nodes? Also, let me know if the next nightly build fixes the viewport bug or not. Jason Fauchelle |
|
|
Hi Jason! I want events raised from the minimap when I click on it. No specific events for nodes or links. I'm processing MouseLeftButtonDown event from the minimap, and when I click on the minimap on a node - event is raised, but when I click on a link - it isn't. I want events rised wherever I click on the minimap. I'm trying to implement navigation for the minimap - when I click at some point on the minimap, the viewport should be placed at that point on the main diagram. And the second moment, the ViewportFrame on the minimap doesn't reflect the Viewport on the main surface properly. Please take a look at the attached picture (ViewportFrame.jpg). I realize it is so because we don't use negative values for coordinates for the ViewportFrame. But if I let the coordinates be negative I get the ViewportFrame out of the bounds of the minimap (please take a look at ViewportFrame2.jpg). Do you have any ideas how to solve this problem? The nightly build for May 24 doesn't fix the viewport bug unfortunately. //Dmitry |
|
|
Hello Dmitry If all you need to listen to is the mouse events on the minimap, then I would recommend putting some kind of element over the top of the minimap to gather the mouse events. Since you already have the ViewportFrameControl over the minimap, this is a great candidate for listening to mouse events - especially since the results of the mouse events are related to the viewport. In App.xaml of the sample I sent you, you will find the viewport frame style. The root element of the template is a Grid. If you set the Background of the Grid to be Transparent, then it will pick up the mouse events which you can listen to in the ViewportFrameControl. The incorrect position of the viewport frame in the first image you attached is due to a bug in the ViewportFrameControl I sent you. There are 2 ways you could fix this. 1) On the root grid of the ViewportFrameControl template, set ClipsToBounds to true. Then at the end of the UpdateFrame method in the ViewportFrameControl class, remove most of the Math.Min and Math.Max statements. The last 3 lines of code will now look like this:
2) You could fix the bug by replacing the last 3 lines of the UpdateFrame method with this:
The difference between these two approaches is that the second one will keep the dotted lines against the edge of minimap if the viewport goes out of bounds. Whereas the first one will simply clip the viewport finder. I have not been able to reproduce the issue with the viewport of the minimap. Could you please send a simple repro so I can look into this issue further. Jason Fauchelle |
|
|
Hello Jason! Thank you very much, ViewPortFrame looks well now. But I still see incorrect reflection of nodes on the minimap. I mean the following bug - if I place the first node on the diagram, it is not displayed in the center of the minimap as I expect. To reproduce this you can just execute the Flow diagrams demo sample. I've reproduced the bug like this:
But if you add the first node and then move it somewhere, it will be in the center of the minimap. And one more strange behavior that I faced recently. Repro steps are the following:
And after that I see DiagramBounds equal to NaNs (Width and Height). Do you have any ideas why it can be so? //Dmitry |
|
|
Hello Dmitry Thanks for pointing out the centering issue still remains. I've found the cause of this bug and resolved the issue which will be available through the next nightly build. I was unable to repro the second issue you mentioned here so I'm probably setting it up wrong. If this second issue has not been resolved in the next nightly build, please send me a repro project or some code snippets. Jason Fauchelle |
|
|
Hello Jason! Thanks! I see the first issue is resolved. Regarding the second one, I've found the cause of it in my own code. Sorry for the trouble. //Dmitry |
|