-
Notifications
You must be signed in to change notification settings - Fork 122
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(brush): force brush tool per panel #1071
fix(brush): force brush tool per panel #1071
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, tested locally and fixes issue. I don't see any issues with brushing on non-small multiple charts.
export function getBrushForXAxis( | ||
chartRotation: Rotation, | ||
{ hPanelStart, vPanelStart, hPanelWidth, vPanelHeight, start, end }: PanelPoints, | ||
) { | ||
const rotated = isVerticalRotation(chartRotation); | ||
|
||
return { | ||
left: getLeftPoint(chartDimensions, start), | ||
top: getTopPoint(chartDimensions, start), | ||
height: getMinimalHeight(start, end), | ||
width: getMinimalWidth(start, end), | ||
left: rotated ? hPanelStart : start.x, | ||
top: rotated ? start.y : vPanelStart, | ||
height: rotated ? getMinSize(start.y, end.y) : vPanelHeight, | ||
width: rotated ? hPanelWidth : getMinSize(start.x, end.x), | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These diffs are horribly misaligned 🙄 ....git 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, I've refactored a bit the code cleaning up it a bit, but the diff is a bit messy, better to check both file side by side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #1071 +/- ##
==========================================
+ Coverage 72.47% 73.09% +0.61%
==========================================
Files 366 383 +17
Lines 11361 11726 +365
Branches 2472 2527 +55
==========================================
+ Hits 8234 8571 +337
- Misses 3112 3132 +20
- Partials 15 23 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This commit force the brush tool to work per panel when using small multiples. This behavior is built to works independently from the presence or absence of a small multiples configuration. It works by forcing the brushable area to be constraint between the boundaries of the panel where the brushing event started. The brush selection doesn't move between panels and the coordinate of the mouse down event determines the limiting panel. fix elastic#1070
This commit force the brush tool to work per panel when using small multiples. This behavior is built to works independently from the presence or absence of a small multiples configuration. It works by forcing the brushable area to be constraint between the boundaries of the panel where the brushing event started. The brush selection doesn't move between panels and the coordinate of the mouse down event determines the limiting panel. fix #1070
🎉 This PR is included in version 25.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [25.3.0](elastic/elastic-charts@v25.2.0...v25.3.0) (2021-03-11) ### Bug Fixes * **brush:** force brush tool per panel ([opensearch-project#1071](elastic/elastic-charts#1071)) ([61d6b7a](elastic/elastic-charts@61d6b7a)), closes [opensearch-project#1070](elastic/elastic-charts#1070) ### Features * debug state for the heatmap chart ([opensearch-project#976](elastic/elastic-charts#976)) ([9ba7666](elastic/elastic-charts@9ba7666))
Summary
This PR forced the brush tool to work per panel when using small multiples. This behavior is built to works independently from the presence or absence of a small multiples configuration.
It works by forcing the brushable area to be constraint between the boundaries of the panel where the brushing event started. The brush selection doesn't move between panels and the coordinate of the mouse down event determines the limiting panel.
I've cleaned up the code to compute the brush area and also updated the unit test by mocking the SmallMultiple specs
fixes #1070
Mar-11-2021.13-28-00.mp4