interface IInfoList { key : string ; value : string ; isDefault ? : boolean ; } interface IInputList { key : string ; value : string ; isMulti ? : boolean ; subSelected ? : IInfoList [ ] ; } class ToolStyleUtils { param rgba param opacity returns public static replaceAFromRGBA = ( rgba , opacity ) => { return rgba . split ( " " ) . join ( "" ) . replace ( /,[0-9]+([.]{1}[0-9]+){0,1}\)/ , `,${ opacity . toFixed ( 2 ) })` ) ; } ; param color param hover param selected param options returns public static getToolStrokeAndFill = ( color , options ) => { const { hover = false , selected = false , borderOpacity = 1 , fillOpacity = 1 , commonOpacity = 0.8 , } = options ; if ( selected || hover ) { return { stroke : this . replaceAFromRGBA ( color , borderOpacity ) , fill : this . replaceAFromRGBA ( color , fillOpacity ) , } ; } return { stroke : this . replaceAFromRGBA ( color , borderOpacity * commonOpacity ) , fill : this . replaceAFromRGBA ( color , fillOpacity * commonOpacity ) , } ; } ; param attribute param attributeList returns { number } public static getAttributeIndex = ( attribute , attributeList ) => { try { const attributeIndex = attributeList . findIndex ( ( i ) => i . value === attribute ) ; return attributeIndex ; } catch ( error ) { return - 1 ; } } ; } export default ToolStyleUtils ;