-
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
Video-docking: Implement drag and drop #10394
Conversation
2b526b2
to
1b9d238
Compare
1b9d238
to
cb4c16a
Compare
@wassgha planning a different PR for this? |
No but I'm rearranging the commits (A lot of conflicts and I didn't wanna do it for every commit). It automatically closed because I rolled back the commits.
|
Ready for review once Travis passes |
9e4ec25
to
67bb5ad
Compare
Updated description |
src/service/video-manager-impl.js
Outdated
@@ -894,13 +945,235 @@ class VideoEntry { | |||
// Update docking state | |||
if (this.scrollMap_(DOCK_SCALE, 1) == DOCK_SCALE) { | |||
this.dockState_ = DockStates.DOCKED; | |||
this.initializeDragging_(); |
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.
this is measuring, which we don't wanna do during a mutate, needs to go to its own measure
block.
src/service/video-manager-impl.js
Outdated
@@ -894,13 +945,235 @@ class VideoEntry { | |||
// Update docking state | |||
if (this.scrollMap_(DOCK_SCALE, 1) == DOCK_SCALE) { | |||
this.dockState_ = DockStates.DOCKED; | |||
this.initializeDragging_(); | |||
this.drag_(); |
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.
mmm, drag_()
keeps running every rAF, not great. We need to only run it with touch move
.
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.
It needs to run every RAF for the momentum drag to kick in (so that it moves the element even after the user is no longer dragging until the velocity is null).
src/service/video-manager-impl.js
Outdated
return; | ||
} | ||
|
||
const minimizedRect = this.internalElement_./*OK*/getBoundingClientRect(); |
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.
let's keep drag_
a mutate-only function. Does it need to read this every time? can it by cached by initializeDragging_
?
src/service/video-manager-impl.js
Outdated
|
||
// Re-run on every animation frame | ||
this.vsync_.mutate(() => { | ||
this.drag_(); |
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.
ditto comment above, we should only happen with touch move.
* @param {boolean} updateDisplacement | ||
* @private | ||
*/ | ||
mouse_(e, updateDisplacement = false) { |
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.
related to comments above, we really need to separate measure and mutate and tied to events instead of running every rAF. How about something like:
1- video docked
2- initilaizeDragdrop (in a measure block, cache whatever we need, install handlers, on touchmove
call dragtouchmove_
3- dragtouchmove_
does reads new coordinates from e
and does a mutate
(if we needed to reread anything then split it does both a measure
and mutate
)
We just wanna make sure we never measure during mutate and vice versa.
7ff67a6
to
b738852
Compare
} | ||
|
||
.i-amphtml-dockable-video > video.i-amphtml-dockable-video-minimizing, | ||
.i-amphtml-dockable-video > iframe.i-amphtml-dockable-video-minimizing { | ||
position: fixed; | ||
height: auto; | ||
overflow: hidden; | ||
z-index: 2; | ||
z-index: 16; |
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.
run gulp get-zindex
. it will regenerated the Z_INDEX.md file
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.
Done :) Should be ready to merge.
b738852
to
5b2f5e8
Compare
5b2f5e8
to
12430bd
Compare
merged |
Implements dragging for docked videos.
Changes
To-do in next PRs
click
/mouseover
events and hides the video controls)position: sticky
for cleaner codeCloses #9962, Checks off an item on #4154, Checks off two items on #8088