import _ from "lodash" ; export default class GridOptionsManager { static defaultGridGuideOptions = { snapToGridOnRelease : false , snapToGridDuringDrag : false , snapToAlignmentLocationOnRelease : false , snapToAlignmentLocationDuringDrag : false , distributionGuidelines : false , geometricGuideline : false , initPosAlignment : false , centerToEdgeAlignment : false , resize : false , parentPadding : false , drawGrid : false , gridSpacing : 20 , zoomDash : true , panGrid : true , gridStackOrder : - 1 , gridColor : '#dedede' , lineWidth : 1.0 , guidelinesStackOrder : 4 , guidelinesTolerance : 5.00 , guidelinesStyle : { strokeStyle : "#4286f4" , geometricGuidelineRange : 750 , range : 500 , minDistRange : 10 , distGuidelineOffset : 10 , horizontalDistColor : "#4286f4" , verticalDistColor : "#4286f4" , initPosAlignmentColor : "#34495E" , lineDash : [ 6 , 8 ] , horizontalDistLine : [ 0 , 0 ] , verticalDistLine : [ 0 , 0 ] , initPosAlignmentLine : [ 0 , 0 ] , } , parentSpacing : - 1 } ; currentProperties : any ; cy : any ; constructor ( cy ) { this . cy = cy ; this . currentProperties = { } ; this . changeParameters ( GridOptionsManager . defaultGridGuideOptions ) ; } changeParameters ( params ) { this . currentProperties = _ . clone ( params ) ; this . refreshGridOptionsExtension ( ) ; } getCurrentOptions ( ) { return this . currentProperties ; } getDefaultOptions ( ) { return GridOptionsManager . defaultGridGuideOptions ; } setSnapToGuidelines ( state ) { this . currentProperties . geometricGuideline = state ; this . currentProperties . snapToAlignmentLocationDuringDrag = state ; this . currentProperties . distributionGuidelines = state ; this . refreshGridOptionsExtension ( ) ; } setShowGrid ( state ) { this . currentProperties . drawGrid = state ; this . currentProperties . snapToGridDuringDrag = state ; this . refreshGridOptionsExtension ( ) ; } refreshGridOptionsExtension ( ) { this . cy . gridGuide ( this . currentProperties ) ; } }