@@ -100,10 +100,9 @@ function getEdgeStyle(entity, style) {
100100 const types = JSON . parse ( relationTypes || '[]' ) ;
101101 if ( ids . includes ( id ) || types . includes ( type ) ) {
102102 return {
103- fontSize : compileFontSize ( font . fontSize ) ,
104- fontFamily : font . fontName ,
103+ fontSize : font . fontSize ,
105104 fill : textColor ,
106-
105+ ... formatFontName ( font . fontName ) ,
107106 ...formatFontStyle ( font . fontStyle )
108107 } ;
109108 }
@@ -124,11 +123,10 @@ function getNodeStyle(entity, style) {
124123 if ( ids . includes ( id ) || types . includes ( labels [ 0 ] ) ) {
125124 return {
126125 fillColor : color ,
127- fontSize : compileFontSize ( font . fontSize ) ,
128- fontFamily : font . fontName ,
126+ fontSize : font . fontSize ,
129127 fill : textColor ,
130128 size : size ,
131- // stroke: color ,
129+ ... formatFontName ( font . fontName ) ,
132130 ...formatFontStyle ( font . fontStyle )
133131 } ;
134132 }
@@ -153,18 +151,30 @@ function getNodeLabel(entity, captionField) {
153151}
154152
155153function formatFontStyle ( fontStyle ) {
156- if ( fontStyle === 1 ) {
157- return { fontWeight : 600 } ;
154+ //TODO: fontStyle为0是plain
155+ if ( fontStyle === 1 || fontStyle === 'bold' ) {
156+ return { fontWeight : 'bold' } ;
158157 }
159- if ( fontStyle === 2 ) {
158+ if ( fontStyle === 2 || fontStyle === 'italic' ) {
160159 return { fontStyle : 'italic' } ;
161160 }
161+ if ( fontStyle === 'bolditalic' ) {
162+ return { fontWeight : 'bold' , fontStyle : 'italic' } ;
163+ }
162164 return { } ;
163165}
164166
165- function compileFontSize ( fontSize ) {
166- return fontSize * 0.8 ;
167+ function formatFontName ( fontName ) {
168+ if ( ! fontName ) {
169+ return { } ;
170+ }
171+ const arrs = fontName . split ( '.' ) ;
172+ return {
173+ fontFamily : arrs [ 0 ] ,
174+ ...formatFontStyle ( arrs [ 1 ] )
175+ } ;
167176}
177+
168178// 处理graphMap数据的展开 折叠 隐藏的实体数据
169179export function transformExpandCollapseHiddenData ( graphMap ) {
170180 const { expand, collapse, hidden } = graphMap . dataContent ;
0 commit comments