Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Move the diagram freely on DroidDiagram area (Read 4330 times)
zhang
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: May 28th, 2014
Move the diagram freely on DroidDiagram area
Jun 19th, 2014 at 12:21am
Print Post  
Hello, what my problem is, when I with a finger try to move the diagram on the screen of mobilephone, but I find that, the diagram can only be moved to top and left, can not be moved to right and down. I show this problem by the picture I upload. My code is fast the same as the example Code in "DroidDiagram Programmer's Guide", only add
diagView.setBehavior(Behavior.Pan);
Besides, the example Program in "DroidDiagram Programmer's Guide" also has the same Problem.Could you tell me how can I move the diagram freely on DroidDiagram-Background-area?
In other word, it should be enabled to move to right,left,down and top -area. Thank you very much indeed!
  

2014-06-19_01-47-00.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Move the diagram freely on DroidDiagram area
Reply #1 - Jun 19th, 2014 at 7:10am
Print Post  
Hi,

The scroll range depends on Diagram.Bounds value. If the diagram content is at the top-left of Diagram.Bounds, you won't be able to scroll it to bottom-right because scroll position would end up outside the Bounds rectangle. You could set diagram.Bounds to a rectangle created by inflating Diagram.getContentRect() by the screen's width and height to enable scrolling the content to all edges of the screen:

Code
Select All
// build and arrange the diagram
// ...

RectF bounds = diagram.getContentRect(false, false);
bounds.inset(-screenW, -screenH);
diagram.setBounds(bounds); 



where screenW and screenH and the screen dimensions specified in diagram's MeasureUnit.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
zhang
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: May 28th, 2014
Re: Move the diagram freely on DroidDiagram area
Reply #2 - Jun 19th, 2014 at 8:57am
Print Post  
I can not find a method called getContentRect() in Android-Mindfusion, in other word, diagram.getContentRect(false,false) can not be used in Android development.
could you give me a another alternative Method that exists in Android-Mindfusion? thank you very much.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Move the diagram freely on DroidDiagram area
Reply #3 - Jun 19th, 2014 at 9:37am
Print Post  
Sorry, I haven't noticed it's internal. The same method is called by resizeToFitItems, so you could change the code to this:

Code
Select All
diagram.resizeToFitItems(0);
RectF bounds = diagram.getBounds();
bounds.inset(-screenW, -screenH);
diagram.setBounds(bounds); 

  
Back to top
 
IP Logged
 
zhang
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: May 28th, 2014
Re: Move the diagram freely on DroidDiagram area
Reply #4 - Jun 19th, 2014 at 10:40am
Print Post  
it works perfect! thank you indeed!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint