mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-03-10 09:33:47 +00:00
Added freeze URL parameter to disable animations
This commit is contained in:
@@ -188,6 +188,7 @@ interface Arguments {
|
||||
chartType: ChartType;
|
||||
gedcom?: string;
|
||||
images?: Map<string, string>;
|
||||
freezeAnimation?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,6 +229,7 @@ function getArguments(location: H.Location<any>): Arguments {
|
||||
standalone: getParam('standalone') !== 'false', // True by default.
|
||||
source,
|
||||
authcode: getParam('?authcode'),
|
||||
freezeAnimation: getParam('freeze') === 'true', // False by default
|
||||
|
||||
// Hourglass is the default view.
|
||||
chartType: chartTypes.get(view) || ChartType.Hourglass,
|
||||
@@ -273,6 +275,8 @@ interface State {
|
||||
/** Source of the data. */
|
||||
source?: DataSourceEnum;
|
||||
loadingMore?: boolean;
|
||||
/** Freeze animations after initial chart render. */
|
||||
freezeAnimation?: boolean;
|
||||
}
|
||||
|
||||
export class App extends React.Component<RouteComponentProps, {}> {
|
||||
@@ -415,6 +419,7 @@ export class App extends React.Component<RouteComponentProps, {}> {
|
||||
standalone: args.standalone,
|
||||
chartType: args.chartType,
|
||||
source: args.source,
|
||||
freezeAnimation: args.freezeAnimation,
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
@@ -550,6 +555,7 @@ export class App extends React.Component<RouteComponentProps, {}> {
|
||||
selection={this.state.selection}
|
||||
chartType={this.state.chartType}
|
||||
onSelection={this.onSelection}
|
||||
freezeAnimation={this.state.freezeAnimation}
|
||||
ref={(ref) => (this.chartRef = ref)}
|
||||
/>
|
||||
{this.state.showSidePanel ? (
|
||||
|
||||
@@ -133,6 +133,7 @@ export interface ChartProps {
|
||||
selection: IndiInfo;
|
||||
chartType: ChartType;
|
||||
onSelection: (indiInfo: IndiInfo) => void;
|
||||
freezeAnimation?: boolean;
|
||||
}
|
||||
|
||||
/** Component showing the genealogy chart and handling transition animations. */
|
||||
@@ -191,6 +192,11 @@ export class Chart extends React.PureComponent<ChartProps, {}> {
|
||||
return;
|
||||
}
|
||||
|
||||
// Freeze changing selection after initial rendering.
|
||||
if (!args.initialRender && this.props.freezeAnimation) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.initialRender) {
|
||||
(d3.select('#chart').node() as HTMLElement).innerHTML = '';
|
||||
this.chart = createChart({
|
||||
|
||||
Reference in New Issue
Block a user