Skip to content

feat: pass scales and options to overlay snippet #127

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 1 commit into from
Jul 8, 2025

Conversation

gka
Copy link
Contributor

@gka gka commented Jul 8, 2025

This pull request enhances the functionality of the overlay snippet by passing additional contextual data.

Enhancements to overlay functionality:

  • Updated overlay rendering in Plot.svelte: The overlay snippet now receives additional parameters, including plot dimensions (width, height), options (plotOptions), scales, and flags indicating explicit axes and grid presence. This enables more dynamic and context-aware overlays.
  • Modified PlotOptions type in plot.ts: The overlay property type was updated to include a structured snippet that accepts an array with detailed plot state information, enhancing type safety and usability.

Copy link

github-actions bot commented Jul 8, 2025

📦 Preview package for this PR is published!

Version: 0.3.6-pr-127.0

Install it with:

npm install svelteplot@pr-127
# or install the specific version
npm install svelteplot@0.3.6-pr-127.0

Copy link

netlify bot commented Jul 8, 2025

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit a4250fb
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/686d35d76b122300088f9959
😎 Deploy Preview https://deploy-preview-127--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 requested a review from Copilot July 8, 2025 15:23
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 PR enhances the overlay snippet by passing richer plot context (dimensions, options, scales, and axis/grid flags) into the render call.

  • Expanded the overlay type in PlotOptions to carry structured context.
  • Updated Plot.svelte to forward new parameters (mapXY, projection and explicit axis/grid flags) to the overlay renderer.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lib/types/plot.ts Updated overlay property to Snippet<…> with context
src/lib/core/Plot.svelte Passed additional parameters into {@render overlay}

@@ -466,7 +466,7 @@ export type PlotOptions = {
* The overlay snippet is useful for adding a layer of custom HTML markup
* in front of the SVG body of your plot, e.g. for HTML tooltips.
*/
overlay: Snippet;
overlay: Snippet<[{ width: number; height: number; options: PlotOptions; scales: PlotScales }]>;
Copy link
Preview

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overlay signature only includes width, height, options, and scales, but the Svelte invocation also passes mapXY, hasProjection, and the explicit axis/grid flags. Update the generic type to include those additional properties or consolidate into a named OverlayContext type.

Suggested change
overlay: Snippet<[{ width: number; height: number; options: PlotOptions; scales: PlotScales }]>;
overlay: Snippet<[OverlayContext]>;

Copilot uses AI. Check for mistakes.

@@ -519,7 +519,20 @@
{/if}
</FacetGrid>
</svg>
{#if overlay}<div class="plot-overlay">{@render overlay?.()}</div>{/if}
{#if overlay}<div class="plot-overlay">
{@render overlay?.({
Copy link
Preview

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call site treats overlay as a single-object argument, but the type expects an array of arguments (Snippet<[OverlayContext]>). Align the invocation with the updated signature, e.g., overlay?.([ { … } ]), or adjust the type to accept an object directly.

Copilot uses AI. Check for mistakes.

@gka gka merged commit 9cad0f8 into main Jul 8, 2025
8 checks passed
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.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy