Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Non resizable diagram alignment grid during zoom in/out ! (Read 905 times)
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Non resizable diagram alignment grid during zoom in/out !
Jun 25th, 2019 at 5:22am
Print Post  
Hi,

We show the diagram background alignment grid like this,

this.diagram.setShowGrid(true);

But when zoom in/out, the background grid size also gets changed. Is there any way to stop this?

Regards,
Kannan
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Non resizable diagram alignment grid during zoom in/out !
Reply #1 - Jun 25th, 2019 at 8:09am
Print Post  
Hi,

The background grid measures distances in diagram units, that's why it scales, when the view is zoomed. To achieve something close to your requirement, you can adjust the gridSizeX and gridSizeY values in response to a zoom event:
Code (Javascript)
Select All
diagram.setVirtualScroll(true); // required for better performance

var defaultGridSize = 4; // this is the default diagram gridSizeX/Y value, can set to other initial value.

diagram.addEventListener("zoomChanged", function (sender, args)
{
    var scale = diagram.getZoomFactor() / 100;
    diagram.setGridSizeX(defaultGridSize / scale);
    diagram.setGridSizeY(defaultGridSize / scale);
}); 



Alternatively, you can consider setting a background image, representing a static grid.

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