Snap Settings not working

Hi, 

I am using diagram where i give the option to the user to choose 
1. SnapToLines 
2. SnapToObjects 
3. SHow/Hide Lines. 

I use checkbox to get the input. If checked it's true

Show/hide lines is working fine.
But when i use other 2 Settings with ShowLines it is not working.

My relevant code is as follows

// in .ts

public gridLines:string = 'ShowLines';
public gridLinesColor:string = '#dddddd';
public snapSettings: SnapSettingsModel = {
constraints:SnapConstraints.SnapToLines | SnapConstraints[this.gridLines],
horizontalGridlines: {
lineColor: this.gridLinesColor
},
verticalGridlines: {
lineColor: this.gridLinesColor
}
};

// in .html file

<ejs-diagram id="diagram" #diagram
[getNodeDefaults]="nodeDefaults"
[getConnectorDefaults] ='connectorDefaults'
width="1080px" height="1080px"
(collectionChange)="collectionChange($event)"
[snapSettings]='snapSettings'
[pageSettings]="pageSettings">
ejs-diagram>

If SnapConstraints[this.gridLines] alone is used, then it works.

Attachment: UI_482ff40f.zip

1 Reply 1 reply marked as answer

GG Gowtham Gunashekar Syncfusion Team January 22, 2021 12:17 PM UTC

Hi Kaushik, 
 
We have attached a sample to demonstrate  how to use the snap constraints. In the sample we have explained how to set snap constraints to show or hide grid line, snap to object, snap to line. 
 
 
Regards, 
Gowtham. 
 


Marked as answer
Loader.
Up arrow icon