Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram default scale (Read 177 times)
Bbuzz
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Dec 4th, 2024
Diagram default scale
Dec 4th, 2024 at 9:14am
Print Post  
I am creating a ShapeNode in a DiagramView:
.createShapeNode(100, 100, 20, 10)

When I look at the result on screen, all dimensions are scaled for some reason. E.g. the resulting node on screen is not 20 pixels wide but 76.
Checking my diagramview instance, I see it has a _scale property with a value of 3.78, which explains the discrepancy.
But where and how is that scale setting set ? I am not doing it. And how would I set it to 1 ?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Diagram default scale
Reply #1 - Dec 4th, 2024 at 9:43am
Print Post  
Hi,

The scale comes from Diagram.measureUnit property, whose default value is Millimeter. You could change it to Pixel, but would also have to adjust some size properties, such as adjustmentHandlesSize, gridSize, etc.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Bbuzz
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Dec 4th, 2024
Re: Diagram default scale
Reply #2 - Dec 4th, 2024 at 10:42am
Print Post  
Hi,

Can you clarify what "Diagram" is in this case for me to do "Diagram.measureUnit" ?
My code just does:

Code (Javascript)
Select All
var myDiagramView = MindFusion.Diagramming.DiagramView.create(document.getElementById("diagram"));
var diagramNode = myDiagramView.diagram.factory.createShapeNode(100, 100, 20, 10); 



myDiagramView does have a measureUnit property, and in my case it returns "6". I don't know what that means.
But I assume you mean something different with "Diagram".
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Diagram default scale
Reply #3 - Dec 4th, 2024 at 11:18am
Print Post  
Hi,

Your Diagram instance is returned by DiagramView.diagram member (through which you also create nodes). E.g. if using the namespaced scripts:

Code
Select All
myDiagramView.diagram.measureUnit = MindFusion.Drawing.GraphicsUnit.Pixel; 



https://www.mindfusion.eu/onlinehelp/jsdiagram/Model_View_Architecture.htm

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Bbuzz
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Dec 4th, 2024
Re: Diagram default scale
Reply #4 - Dec 4th, 2024 at 11:57am
Print Post  
OK understood, values now match what I see on-screen.

Thanks Slavcho !
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint