mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-27 22:21:53 +00:00
First version of integrating donatso/family-chart #185
This commit is contained in:
@@ -26,6 +26,7 @@ import {
|
||||
CircleRenderer,
|
||||
ChartColors as TopolaChartColors,
|
||||
} from 'topola';
|
||||
import {usePrevious} from './util/previous-hook';
|
||||
|
||||
/** How much to zoom when using the +/- buttons. */
|
||||
const ZOOM_FACTOR = 1.3;
|
||||
@@ -217,6 +218,7 @@ export async function downloadPdf() {
|
||||
export enum ChartType {
|
||||
Hourglass,
|
||||
Relatives,
|
||||
Donatso,
|
||||
Fancy,
|
||||
}
|
||||
|
||||
@@ -402,14 +404,6 @@ class ChartWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
function usePrevious<T>(value: T): T | undefined {
|
||||
const ref = useRef<T | undefined>(undefined);
|
||||
useEffect(() => {
|
||||
ref.current = value;
|
||||
});
|
||||
return ref.current;
|
||||
}
|
||||
|
||||
export function Chart(props: ChartProps) {
|
||||
const chartWrapper = useRef(new ChartWrapper());
|
||||
const prevProps = usePrevious(props);
|
||||
|
||||
Reference in New Issue
Block a user