Skip to content

Commit

Permalink
feat: 添加默认宽高
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Dec 28, 2020
1 parent 9db6e27 commit cbc1e29
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 3 additions & 4 deletions packages/legend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ const View = (props) => {
return (
<group style={{
flexDirection: 'row',
flex: 1,
padding: 20
}}>
<text style={{
flex: 1,
}}
flex: 1,
}}
attrs={{
text: '11',
fill: '#000'
}}
/>
<text style={{
fill: 1,
flex: 1,
}}
attrs={{
text: JSON.stringify(record),
Expand Down
16 changes: 15 additions & 1 deletion packages/react/src/chart/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,26 @@ export default ({ canvasRef, pixelRatio, data, children }) => {
});

const frontPlot = chart.get('frontPlot');
const width = chart.get('width');
const height = chart.get('height');
// @ts-ignore
chart.on('aftergeomdraw', () => {
// component render
for (let i = 0, len = components.length; i < len; i++) {
const component = components[i];
render(component.render(), frontPlot);

const element = component.render();
if (element) {
const style = element.style;
element.style = {
// 设置元素默认宽高
width,
height,
...style
}
console.log(element);
render(element, frontPlot);
}
}
});

Expand Down

0 comments on commit cbc1e29

Please sign in to comment.