-
-
Notifications
You must be signed in to change notification settings - Fork 14
fix: area mark event handlers #132
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
Conversation
resolves #130
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-132
# or install the specific version
npm install svelteplot@0.3.7-pr-132.0 |
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Pull Request Overview
This pull request adds event handling capabilities to area marks in the plotting library and provides a demonstration example. The changes enable interactive features like responding to pointer events within area plots.
- Imported and applied the
addEventHandlers
helper to theArea.svelte
component - Created a new interactive example showcasing area plot event handling with dynamic title updates and opacity changes
- Enabled area marks to receive event context including plot state, options, and datum data
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/lib/marks/Area.svelte |
Added event handler support by importing and applying the addEventHandlers action to the area path element |
src/routes/examples/area/events.svelte |
Created new example demonstrating interactive area plots with pointer event handling |
Comments suppressed due to low confidence (1)
src/routes/examples/area/events.svelte:13
- The variable name 'lastClicked' is misleading since the event handler uses 'onpointerenter', not a click event. Consider renaming to 'lastHovered' or 'hoveredArea' to accurately reflect the interaction.
let lastClicked = $state();
📦 Preview package for this PR is published! Version: Install it with: npm install svelteplot@pr-132
# or install the specific version
npm install svelteplot@0.3.7-pr-132.1 |
✅ Deploy Preview for svelteplot ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Please view comment here: |
This pull request introduces event handling support for area marks in the plotting library and demonstrates its usage with a new example. The main changes add a helper for event handlers to
Area.svelte
, enabling interactive features such as responding to pointer events in area plots.Event handling support for area marks:
addEventHandlers
helper import toArea.svelte
, preparing the component to support custom event handlers for area marks.addEventHandlers
action to the area<path>
element inArea.svelte
, allowing events like pointer enter to be handled and passed relevant context (getPlotState
,options
,datum
).New interactive area plot example:
src/routes/examples/area/events.svelte
to showcase interactive area plots. This example updates the plot title and area opacity dynamically based on pointer events, demonstrating how to use event handlers with area marks.resolves #130