8000 feat(widgets): minimal TimelineWidget (PoC) by ibgreen · Pull Request #9587 · visgl/deck.gl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(widgets): minimal TimelineWidget (PoC) #9587

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
Apr 17, 2025
Merged

feat(widgets): minimal TimelineWidget (PoC) #9587

merged 2 commits into from
Apr 17, 2025

Conversation

ibgreen
Copy link
Collaborator
@ibgreen ibgreen commented Apr 17, 2025

Closes #

Background

Having at least some kind of minimal timeline widget seems essential to a code widget offering.

This is an extremely minimal PoC, just to get some basic working code in place.

TODO

  • Integrate something like TripsLayer into the example
  • Improve the styling
  • Add tick marks and labels, current time, etc.
  • ...

timeline-widget

Change List

@ibgreen ibgreen requested a review from chrisgervang April 17, 2025 13:52
@coveralls
Copy link
coveralls commented Apr 17, 2025

Coverage Status

coverage: 91.489%. remained the same
when pulling d736d44 on timeline-widget
into baa7f33 on master.

Copy link
Collaborator
@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together. I left a few comments, but overall I think this is a solid POC. Let’s export it as an experimental for now - I’m not yet convinced this will be the final API.

I’d like to see additional explorations that better support handling date-time domains, and I’m unsure about exposing step as a prop.

It looks a bit like this widget is blending two separate concerns: a generic value slider and a timeline-style scrubber with time-domain semantics (e.g. time intervals, playhead). I’d recommend splitting these into separate widgets and keeping this one focused on time semantics.

this.props.onTimeChange(next);
this.renderUI();
if (this.playing) {
this.timerId = window.setTimeout(this.tick, this.props.playInterval);
< 10000 clipboard-copy aria-label="Copy link" for="discussion_r2049329260-permalink" role="menuitem" data-view-component="true" class="dropdown-item btn-link"> Copy link
Collaborator

Choose a reason for hiding this comment

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

setTimeout works well for longer intervals like 1000ms and is easy to customize, but it’s less consistent for smooth playback. A requestAnimationFrame-based approach, like luma’s Timeline, provides smoother results.

Using setTimeout for a POC is fine.

Comment on lines +89 to +98
if (this.element) {
// update className
this.element.className = ['deck-widget', 'deck-widget-timeline', this.props.className]
.filter(Boolean)
.join(' ');
// update style
if (props.style) {
Object.assign(this.element.style, this.props.style);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use the same CSS update method as the other widgets. This method makes unnecessary mutations and doesn't support removing styles as you'd expect.

https://github.com/visgl/deck.gl/blob/master/modules/widgets/src/fullscreen-widget.tsx#L111-L121

new FullscreenWidget({style: widgetTheme}),
new TimelineWidget({
style: widgetTheme,
domain: [0, 24],
Copy link
Collaborator

Choose a reason for hiding this comment

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

A gotcha to include in our docs is the same gotcha that we document in TripsLayer - it's typical for time domains to overflow integers, so users should be mindful and apply an offset

/**
* Current slider value.
*/
value?: number;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
value?: number;
currentTime?: number;

Consider using time oriented names

/**
* Slider domain [min, max].
*/
domain?: [number, number];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
domain?: [number, number];
timeDomain?: [number, number];

Consider using time oriented names and also supporting [Date, Date]?

/**
* Slider step.
*/
step?: number;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this? It sounds redundant to interval.

@ibgreen ibgreen mentioned this pull request Apr 17, 2025
60 tasks
@ibgreen
Copy link
Collaborator Author
ibgreen commented Apr 17, 2025

Linked the feedback into the tracker, will land for now

@ibgreen ibgreen merged commit 342deda into master Apr 17, 2025
2 checks passed
@ibgreen ibgreen deleted the timeline-widget branch April 17, 2025 18:42
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.

3 participants
0