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 drag rectangle calculation when inside shadow BOM / WebComponent #732

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

CodingMarco
Copy link
Contributor

Fixes #726.

The edges of the drag rectangle were calculated incorrectly when the chart is placed inside a shadow BOM (eg. inside a web component). Chart.js itself already has fixes for that (see Chart.js PRs). Its getRelativePosition() function always returns the correct coordinates.
So import and use this function from Chart.js.

The edges of the drag rectangle were calculated incorrectly
when the chart is placed inside a shadow BOM
(eg. inside a web component). Chart.js itself already has fixes
for that (see PRs #7225 and #8082). Its getRelativePosition()
function always returns the correct coordinates.
So import and use this function from Chart.js.
@kurkle
Copy link
Member

kurkle commented Mar 1, 2023

CI fails because of FF, fix is same as in Chart.js: https://github.com/chartjs/Chart.js/pull/11165/files
Feel free to create another PR for that fix

@kurkle kurkle added this to the 2.0.1 milestone Mar 16, 2023
@kurkle kurkle added the bug label Mar 16, 2023
@kurkle kurkle merged commit 8c39fba into chartjs:master Mar 16, 2023
@CodingMarco CodingMarco deleted the shadow-bom-drag-fix branch March 16, 2023 22:06
@jcphill
Copy link

jcphill commented Sep 26, 2023

getRelativePosition seems to give the wrong position when mouseup occurs over a different element (as when a drag ends outside the chart canvas), which is causing the regression in #770

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chart / Zoom inside a webcomponent is offset
4 participants