Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tooltip): hide tooltip when move mask #4860

Merged
merged 1 commit into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
48 changes: 48 additions & 0 deletions __tests__/plots/tooltip/alphabet-interval-brush-tooltip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { CustomEvent } from '@antv/g';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { brush } from '../interaction/penguins-point-brush';

export function alphabetIntervalBrushTooltip(): G2Spec {
return {
type: 'interval',
transform: [{ type: 'sortX', by: 'y', reverse: true }],
data: {
type: 'fetch',
value: 'data/alphabet.csv',
},
encode: {
x: 'letter',
y: 'frequency',
color: 'steelblue',
},
state: {
active: { fill: 'red' },
},
interaction: {
brushHighlight: true,
},
};
}

alphabetIntervalBrushTooltip.steps = ({ canvas }) => {
const { document } = canvas;
const plot = document.getElementsByClassName(PLOT_CLASS_NAME)[0];
return [
{
skip: true,
changeState: () => {
brush(plot, 400, 300, 600, 400);
},
},
{
changeState: () => {
plot.dispatchEvent(
new CustomEvent('pointerover', {
offsetX: 500,
offsetY: 360,
}),
);
},
},
];
};
1 change: 1 addition & 0 deletions __tests__/plots/tooltip/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ export { profitIntervalLegendFilterOrdinal } from './profit-interval-legend-filt
export { aaplLineSliderFilter } from './appl-line-slider-filter';
export { aaplLineAreaBasicSample } from './aapl-line-area-basic-sample';
export { aaplAreaMissingDataTranspose } from './aapl-area-missing-data-transpose';
export { alphabetIntervalBrushTooltip } from './alphabet-interval-brush-tooltip';
5 changes: 4 additions & 1 deletion src/interaction/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,10 @@ export function tooltip(
const pointerover = throttle(
(event) => {
const { target: element } = event;
if (!elementSet.has(element)) return;
if (!elementSet.has(element)) {
hideTooltip(root, single);
return;
}
pearmini marked this conversation as resolved.
Show resolved Hide resolved
const k = groupKey(element);
const group = keyGroup.get(k);
const data =
Expand Down