Skip to content

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

Merged
merged 2 commits into from
Aug 5, 2025
Merged

fix: area mark event handlers #132

merged 2 commits into from
Aug 5, 2025

Conversation

gka
Copy link
Contributor

@gka gka commented Aug 5, 2025

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:

  • Added the addEventHandlers helper import to Area.svelte, preparing the component to support custom event handlers for area marks.
  • Applied the addEventHandlers action to the area <path> element in Area.svelte, allowing events like pointer enter to be handled and passed relevant context (getPlotState, options, datum).

New interactive area plot example:

  • Created 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

Copy link

github-actions bot commented Aug 5, 2025

📦 Preview package for this PR is published!

Version: 0.3.7-pr-132.0

Install it with:

npm install svelteplot@pr-132
# or install the specific version
npm install svelteplot@0.3.7-pr-132.0

Copy link

netlify bot commented Aug 5, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 11b6a1f
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/6892817828deb30009fce9c3
😎 Deploy Preview https://deploy-preview-132--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@Copilot Copilot AI left a 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 the Area.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();

Copy link

github-actions bot commented Aug 5, 2025

📦 Preview package for this PR is published!

Version: 0.3.7-pr-132.1

Install it with:

npm install svelteplot@pr-132
# or install the specific version
npm install svelteplot@0.3.7-pr-132.1

Copy link

netlify bot commented Aug 5, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 509e648
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/689281cbb53eb500086915a1
😎 Deploy Preview https://deploy-preview-132--svelteplot.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gka gka merged commit a7f5ff8 into main Aug 5, 2025
8 checks passed
@gka gka deleted the fix/area-events branch August 5, 2025 22:19
@spandl
Copy link

spandl commented Aug 7, 2025

Please view comment here:
#130 (comment)

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

Successfully merging this pull request may close these issues.

Add interaction support (onclick, onmouseenter, onmouseleave, onmousemove) to Area marks
2 participants