Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Is there an equivalent to "bringIntoView" when in ImageMap mode? (Read 2776 times)
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Is there an equivalent to "bringIntoView" when in ImageMap mode?
Feb 5th, 2013 at 8:51pm
Print Post  
Hi,

In another post that I created, I was provided with a function that used the bringIntoView method.  This has served me well when using the JavaApplet.

I would like to be able to do the same for my users that are in ImageMap mode.

Is there a method or approach that I can use to accomplish this.

Code snippets are always welcomed Smiley

Thanks in advance.

Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Is there an equivalent to "bringIntoView" when in ImageMap mode?
Reply #1 - Feb 6th, 2013 at 3:15pm
Print Post  
Hi,

If you know on the server side how big your view will be in the browser, call the ClientToDoc method to find its size in diagram's measure units, and then set

view.ScrollX = node.GetCenter().X - viewSize.X / 2;
view.ScrollY = node.GetCenter().Y - viewSize.Y / 2;

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: Is there an equivalent to "bringIntoView" when in ImageMap mode?
Reply #2 - Feb 10th, 2013 at 5:12pm
Print Post  
Hi Stoyan,

Thanks for the code, but I'm a bit confused about how to make it work.

Here's what I have so far, which creates a small window (500px X 500px), but the node is not visible in this window (not even close actually).
In fact the slider on the horizontal scrollbar is at the far left, and the slider on the vertical scrollbar is at the top - so it doesn't look like the scroll position was adjusted at all.

Is there something I need to do after setting the view's ScrollX/Y?

Thanks again.

Jim

Code (C++)
Select All
DiagramView3.Height = Unit.Parse("500px");
        DiagramView3.Width = Unit.Parse("500px");
        DiagramNode root = diagram.Nodes[0]; // Locate the root node which is the Process Name
        System.Drawing.RectangleF viewSize = DiagramView3.ClientToDoc(new System.Drawing.Rectangle(0, 0, 500, 500));
        DiagramView3.ScrollX = root.GetCenter().X - viewSize.X / 2;
        DiagramView3.ScrollY = root.GetCenter().Y - viewSize.Y / 2; 

[/code]

And here's the DiagramView declaration:

Code (HTML)
Select All
<ndiag:DiagramView ID="DiagramView3" runat="server" Behavior="Pan" ClientSideMode="ImageMap"
                        JsLibraryLocation="./Js/MindFusion.Diagramming.js" JarLocation="./Java/JDiagram.jar"
                        AppletStartedScript="onAppletStarted" ShowScrollbars="true" ShowOverview="false"
                        OverviewFitAll="true" OverviewTitle="Navigator" Diagram-EnableStyledText="true" ZoomFactor="100">
                    </ndiag:DiagramView> 

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Is there an equivalent to "bringIntoView" when in ImageMap mode?
Reply #3 - Feb 11th, 2013 at 1:55pm
Print Post  
Hi,

Actually ScrollX and ScrollY were not used in ImageMap mode. This version should let you set them from the server side:
https://mindfusion.eu/_beta/netdiag5_scroll.zip

With an older version you could run a client-side script that sets srollLeft and scrollTop on the DiagramView's div, assigning the result of DocToClient(scrollPos) to them.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint