Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Oct 11, 2023
1 parent b53c459 commit ddcd5a6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const SegmentedTabs: React.FunctionComponent<SegmentedTabsProps> = props => {

const [state, setState] = React.useState<{ active: string }>(() => {
const { searchParams } = getSearchParams(window.location);
const active = searchParams.get(queryKey) || defaultActive || items[0].key;
const active = searchParams.get(queryKey) || defaultActive || (items[0] && items[0].key) || '';
return {
active,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ const SegmentedLayout: React.FunctionComponent<UadLayoutProps> = props => {
>
<SegmentedTabs items={items} />
</div>
<div style={{ width: `calc(100% - ${width + padding * 2}px)` }}>{children}</div>
<div
style={{
width: `calc(100% - ${width + padding * 2}px)`,
position: 'relative',
transform: 'scale(1)',
height: 'calc(100% - 12px)',
}}
>
{children}
</div>
</div>
);
};
Expand Down
19 changes: 10 additions & 9 deletions packages/gi-sdk/src/GISDK.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ const GISDK = (props: Props) => {
const constants = useConstant(id, state, updateState);
const { GISDK_ID } = constants;

/**
* 响应 graph 的变化
*/
const handleGraphInit = ins => {
updateState(draft => {
draft.graph = ins;
draft.HAS_GRAPH = true;
});
};
/**
* 响应 props.config 变化
*/
Expand All @@ -67,6 +58,16 @@ const GISDK = (props: Props) => {
});
}, [props.config]);

/**
* 响应 graph 的变化
*/
const handleGraphInit = ins => {
updateState(draft => {
draft.graph = ins;
draft.HAS_GRAPH = true;
});
};

/**
* 响应 config.components 变化,重新渲染组件
*/
Expand Down
1 change: 1 addition & 0 deletions packages/gi-site/src/components/Navbar/SaveWorkbook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const getCover = async (graph: Graph) => {
return new Promise(resolve => {
setTimeout(() => {
const cover = graph.toDataURL('image/png');

resolve(cover);
}, 30);
});
Expand Down
4 changes: 1 addition & 3 deletions packages/graphin/src/compatible/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export default (graph: IGraph) => {
changeSize: size => {
graph.setSize(size);
},
toDataURL: () => {
return true;
},

setAutoPaint: paint => {
return true;
},
Expand Down

0 comments on commit ddcd5a6

Please sign in to comment.