Skip to content

Commit

Permalink
feat:fix label.visible not work
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Feb 5, 2021
1 parent cae7420 commit 20d81f9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
20 changes: 18 additions & 2 deletions packages/graphin/docs/render/element/demos/node-default.tsx
Expand Up @@ -11,21 +11,37 @@ const layout = {
type: 'concentric',
};

console.log('data', data);

const defaultNode = {
type: 'graphin-circle',
style: {
keyshape: {
fill: '#ddd',
fill: '#000',
stroke: '#000',
fillOpacity: 0.1,
size: 30,
},
label: {
visible: false,
},
},
};

const nodeStateStyles = {
status: {
hover: {
label: {
visible: false,
},
},
},
};

export default () => {
return (
<div>
<Graphin data={data} layout={layout} defaultNode={defaultNode} />
<Graphin data={data} layout={layout} defaultNode={defaultNode} nodeStateStyles={nodeStateStyles} />
</div>
);
};
3 changes: 2 additions & 1 deletion packages/graphin/docs/render/element/demos/node.tsx
Expand Up @@ -17,7 +17,8 @@ data.nodes[0].style = {
keyshape: {
size: [80, 80],
stroke: 'red',
fill: 'lightyellow',
fill: 'red',
fillOpacity: 0.2,
},
label: {
value: '设置 keyshape',
Expand Down
4 changes: 4 additions & 0 deletions packages/graphin/src/shape/graphin-circle.ts
Expand Up @@ -117,6 +117,7 @@ const parseLabel = (style: NodeStyle) => {
textAlign: 'center' as TextAlignType,
fill,
textBaseline: labelPos.textBaseline,
visible: visible !== false,
...otherAttrs,
};
return {
Expand All @@ -140,6 +141,7 @@ const parseIcon = (style: NodeStyle) => {
fill,
size,
visible,

...otherAttrs
} = icon;

Expand All @@ -163,6 +165,7 @@ const parseIcon = (style: NodeStyle) => {
fontSize: width,
fontFamily,
fill,
visible: visible !== false,
...otherAttrs,
},
};
Expand All @@ -176,6 +179,7 @@ const parseIcon = (style: NodeStyle) => {
img: value,
width,
height,
visible: visible !== false,
...otherAttrs,
},
};
Expand Down

0 comments on commit 20d81f9

Please sign in to comment.