Skip to content

Commit

Permalink
I forgot to remove renderCursor - it's not used anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelVanecek committed Oct 14, 2023
1 parent c1105c1 commit caf3235
Showing 1 changed file with 2 additions and 65 deletions.
67 changes: 2 additions & 65 deletions src/chart/generateCategoricalChart.tsx
@@ -1,18 +1,14 @@
import React, { Component, cloneElement, isValidElement, createElement, ReactElement } from 'react';
import React, { Component, cloneElement, isValidElement, ReactElement } from 'react';
import classNames from 'classnames';
import _, { isArray, isBoolean } from 'lodash';
import invariant from 'tiny-invariant';
import { getRadialCursorPoints } from '../util/cursor/getRadialCursorPoints';
import { getTicks } from '../cartesian/getTicks';
import { Surface } from '../container/Surface';
import { Layer } from '../container/Layer';
import { Tooltip } from '../component/Tooltip';
import { Legend } from '../component/Legend';
import { Curve } from '../shape/Curve';
import { Cross } from '../shape/Cross';
import { Sector } from '../shape/Sector';
import { Dot } from '../shape/Dot';
import { isInRectangle, Rectangle } from '../shape/Rectangle';
import { isInRectangle } from '../shape/Rectangle';

import {
findAllByType,
Expand Down Expand Up @@ -77,8 +73,6 @@ import { AccessibilityManager } from './AccessibilityManager';
import { isDomainSpecifiedByUser } from '../util/isDomainSpecifiedByUser';
import { deferer, CancelFunction } from '../util/deferer';
import { getActiveShapeIndexForTooltip, isFunnel, isPie, isScatter } from '../util/ActiveShapeUtils';
import { getCursorPoints } from '../util/cursor/getCursorPoints';
import { getCursorRectangle } from '../util/cursor/getCursorRectangle';
import { ChartContextContainer } from '../context/chartContext';
import { TooltipRenderer } from '../renderer/TooltipRenderer';

Expand Down Expand Up @@ -1767,63 +1761,6 @@ export const generateCategoricalChart = ({
return null;
}

renderCursor = (element: ReactElement) => {
const { isTooltipActive, activeCoordinate, activePayload, offset, activeTooltipIndex, tooltipAxisBandSize } =
this.state;
const tooltipEventType = this.getTooltipEventType();

if (
!element ||
!element.props.cursor ||
!isTooltipActive ||
!activeCoordinate ||
(chartName !== 'ScatterChart' && tooltipEventType !== 'axis')
) {
return null;
}
const { layout } = this.props;
let restProps;
let cursorComp: React.ComponentType<any> = Curve;

if (chartName === 'ScatterChart') {
restProps = activeCoordinate;
cursorComp = Cross;
} else if (chartName === 'BarChart') {
restProps = getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize);
cursorComp = Rectangle;
} else if (layout === 'radial') {
const { cx, cy, radius, startAngle, endAngle } = getRadialCursorPoints(activeCoordinate);
restProps = {
cx,
cy,
startAngle,
endAngle,
innerRadius: radius,
outerRadius: radius,
};
cursorComp = Sector;
} else {
restProps = { points: getCursorPoints(layout, activeCoordinate, offset) };
cursorComp = Curve;
}
const key = element.key || '_recharts-cursor';
const cursorProps = {
stroke: '#ccc',
pointerEvents: 'none',
...offset,
...restProps,
...filterProps(element.props.cursor),
payload: activePayload,
payloadIndex: activeTooltipIndex,
key,
className: 'recharts-tooltip-cursor',
};

return isValidElement(element.props.cursor)
? cloneElement(element.props.cursor, cursorProps)
: createElement(cursorComp, cursorProps);
};

renderPolarAxis = (element: any, displayName: string, index: number) => {
const axisType = _.get(element, 'type.axisType');
const axisMap = _.get(this.state, `${axisType}Map`);
Expand Down

0 comments on commit caf3235

Please sign in to comment.