Skip to content

Commit

Permalink
fix(xy): show mouse cursors on charts with opaque background (#1447)
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 authored Oct 29, 2021
1 parent 1d06a1e commit e0f1543
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions integration/tests/interactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,26 @@ describe('Interactions', () => {
);
});
});

describe('mouse cursor', () => {
it.each<string>(['eui-light', 'eui-dark'])(
`should show cursor when background is set with %s theme`,
async (theme) => {
await common.expectChartWithMouseAtUrlToMatchScreenshot(
`http://localhost:9001/?path=/story/mixed-charts--lines-and-areas&globals=theme:${theme}&knob-Fit%20domain_Y%20-%20Axis=true&knob-Log%20base_Y%20-%20Axis=natural&knob-Use%20default%20limit_Y%20-%20Axis=true&knob-Use%20negative%20values_Y%20-%20Axis=false`,
{ top: 150, left: 250 },
);
},
);

it.each<string>(['eui-light', 'eui-dark'])(
`should show cursor band when background is set with %s theme`,
async (theme) => {
await common.expectChartWithMouseAtUrlToMatchScreenshot(
`http://localhost:9001/?path=/story/mixed-charts--bars-and-lines&globals=theme:${theme}&knob-Fit%20domain_Y%20-%20Axis=true&knob-Log%20base_Y%20-%20Axis=natural&knob-Use%20default%20limit_Y%20-%20Axis=true&knob-Use%20negative%20values_Y%20-%20Axis=false`,
{ top: 150, left: 150 },
);
},
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function renderXYChartCanvas2d(
rotation,
geometries,
geometriesIndex,
theme: { axes: sharedAxesStyle, sharedStyle, barSeriesStyle, background },
theme: { axes: sharedAxesStyle, sharedStyle, barSeriesStyle },
highlightedLegendItem,
annotationDimensions,
annotationSpecs,
Expand All @@ -51,7 +51,7 @@ export function renderXYChartCanvas2d(
} = props;
const transform = { x: renderingArea.left + chartTransform.x, y: renderingArea.top + chartTransform.y };
renderLayers(ctx, [
() => clearCanvas(ctx, background.color),
() => clearCanvas(ctx, 'transparent'),

// render panel grid
() => debug && renderGridPanels(ctx, transform, panelGeoms),
Expand Down

0 comments on commit e0f1543

Please sign in to comment.