-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
✨ Implement video docking (minimize to corner) #14961
Conversation
src/static-template.js
Outdated
const refs = map(); | ||
|
||
if (root.hasAttribute('ref')) { |
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.
@jridgewell Added this as a convenience. The alternative would be to modify the result of htmlRefs
when root + refs are meant to be referenced in the same object.
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.
You already have a reference to root
, because you passed it in.
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.
Actually, nvm. I'm noticing that it was designed specifically not to set refs on root.
Love it! Will review when out of WIP! Thanks :) |
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.
Lol, forgot to submit the review.
src/static-template.js
Outdated
const refs = map(); | ||
|
||
if (root.hasAttribute('ref')) { |
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.
You already have a reference to root
, because you passed it in.
@jridgewell Yup, I had added that only as a convenience. Either way, removed. |
I think dragging shouldn't be enabled until the video is fully ducked because it causes some wired behavior if the user snaps the video to a different corner as it is docking. |
@wassgha Fixed. The demo is a little out of date. |
I was playing around with the demo page some. I found that if I selected the cheese slicing video and then scrolled back and forth rapidly with I was testing with Chrome 66 on a Mac, if it's relevant. |
@aghassemi PTAL |
src/service/video/docking.js
Outdated
transitionDurationMs > 200 ? 'ease-in' : 'linear'; | ||
|
||
const positioningStyles = { | ||
'width': px(width), |
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.
do we still need to set width/height given scale is being set now? would be nice to avoid if at all possible since it is causes relayout (although just relayout of video box) if not avoidable, let's add "will-change: width, height, transform" to the CSS of the docking container.
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.
Unfortunately yes, because we need to set the aspect ratio for each sized element.
Made a small optimization to set/reset dimensions only for first and last frames and added will-change
.
|
||
attribute: **`dock`** | ||
|
||
**Experimental feature. Setting this attribute is not currently valid.** |
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.
so I assume the strategy is no experimental flag and using validation rules to keep this experimental until ready? (if so, thumbs up from me)
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.
Yup!
Is the demo page up to date? |
Looks like this knocked 0.5KB off of v0.js. Nice! /cc @jridgewell |
Partial for #14061
Passed over some ideas/corner cases from original implementation (#14614, thanks @wassgha!), but defers to runtime APIs when possible and keeps less state for sanity/robustness.
Features
Demo
http://slicing-cheese.glitch.me
In follow-up PRs:
(in no particular order)
Don't show controls after dragging.(Done already.)Refresh on resize.(Done already.)Video should not switch positions when scrolling quickly past the component container.(Fixed.)