import { precisionControl , transSketchColor } from '../../common/utils' ; import { SKLayer , Border , BorderItem } from '../../types' ; /**
 * 'position': 属性表示 border 设置的位置
 * 1 => Inside border 位于盒子的内部
 * 0 => Center border 盒子便于位于 boder 之间
 * 2 =>  Outside 外边框
 */ export default ( layer ) : Border => { if ( layer . style && layer . style . borders && layer . style . borders . length && layer . _class != 'artboard' ) { let borderList = layer . style . borders . filter ( item => item . isEnabled ) ; if ( borderList . length ) { let borderStyle = borderList [ 0 ] ; let borderAlpha = borderStyle . color . alpha ; if ( layer . style && layer . style . contextSettings ) { borderAlpha = layer . style . contextSettings . opacity * borderAlpha ; } const border = { width : precisionControl ( borderStyle . thickness ) , style : 'solid' , color : transSketchColor ( { red : borderStyle . color . red , green : borderStyle . color . green , blue : borderStyle . color . blue , alpha : borderAlpha , } ) , } ; return { left : border , top : border , right : border , bottom : border } ; } } } ;