techniq / layerchart

Composable Svelte chart components to build a wide range of visualizations
https://www.layerchart.com
MIT License
668 stars 12 forks source link

TransformContext: Track moving, set dragging to false on pointer up #178

Closed dimfeld closed 6 months ago

vercel[bot] commented 6 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
layerchart ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2024 11:38pm
changeset-bot[bot] commented 6 months ago

🦋 Changeset detected

Latest commit: 1cce3f161fb2ed78b6d66f58d68877814050c200

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------- | ----- | | layerchart | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

techniq commented 6 months ago

Thanks @dimfeld. I experimented with using $moving and $dragging within HitCanvas to help with performance.

$dragging works well, but $moving with a spring resolves after many seconds. I tried refining precision, but it was either still too slow, or caused a lot of janky resolving (with values like 1).

https://github.com/techniq/layerchart/assets/177476/686e2f10-4251-4e16-a60d-0463ac5da612

I'm going to merge this as it's helpful to know the state, and we can always refine how it's used. For now, I'm only going to update HitCanvas to not render when dragging, which is a good win in itself.

dimfeld commented 6 months ago

Yeah that’s what I saw as well. I think there are other good reasons to not hide the HitCanvas when moving too, such as clicking two countries in rapid succession in the animated globe example.