Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Image cropping issue (Read 2804 times)
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Image cropping issue
Jul 28th, 2011 at 10:30am
Print Post  
I have a diagramView that is set to 100% width. I also have an overview on the page.

I am getting a strange problem that is best described using this image:
http://imageshack.us/photo/my-images/52/jdiagram.png/

Basically, the image is being cropped, even though there is plenty of room for it to be displayed. Is there something I am doing wrong?

One another issue on the same image - the arrows seem to be too big. Is there any way of spacing the diagram out a little more, or reducing the size of the arrows?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Image cropping issue
Reply #1 - Jul 28th, 2011 at 11:42am
Print Post  
Increase the Bounds of the diagram. It is too small in your case and the outside items get clipped.

Judging by the image above you are using the built-in TreeLayout. You can increase the spacing between adjacent levels in the tree through the setLevelDistance method of the layout object. You can also reduce the size of the arrows through the DiagramLink.setHeadShapeSize method.

Regards,
Meppy
  
Back to top
 
IP Logged
 
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Re: Image cropping issue
Reply #2 - Aug 2nd, 2011 at 2:38pm
Print Post  
Is there any way to get the diagram to expand automatically according to the nodes within it?
  
Back to top
 
IP Logged
 
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Re: Image cropping issue
Reply #3 - Aug 2nd, 2011 at 2:40pm
Print Post  
Actually, doesnt matter. I've just found the answer:

diagram.resizeToFitItems(10.0, true);

But is there a way to align the diagram into the center?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Image cropping issue
Reply #4 - Aug 2nd, 2011 at 3:02pm
Print Post  
Try this:

Code
Select All
var bounds = diagram.getBounds();
var deviceBounds = view.docToDevice(bounds);
var viewportWidth = parseFloat(diagramView.style.width);
var viewportHeight = parseFloat(diagramView.style.height);
var scrollX = deviceBounds.width / 2 - viewportWidth / 2;
var scrollY = deviceBounds.height / 2 - viewportHeight / 2;
var point = view.deviceToDoc(script.createPoint(scrollX, scrollY));
view.setScrollX(point.x);
view.setScrollY(point.y); 


The variables view, diagram and script reference the DiagramView, Diagram and ScriptHelper objects respectively. The variable diagramView is the HTML declaration of the DiagramView control on your page. I'm using diagramView to obtain the current viewport size.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint