[dragdrop] Add files-ng drag drop chip
The files app drag drop chip is rendered in a #drag-container element, that must be visible to the browser, but hidden with z-index:-1 behind the files app #dialog-container (invisible to users). The files-ng drag drop chip differs from non-files-ng in its CSS style and also its HTML structure. Prefix existing #drag-container CSS with body:not(.files-ng). Move the #drop-label CSS into that group, add the same prefix and TODO comments about removing the #drop-label element. Add a CSS body.files-ng #drag-container group, used to style drag drop container structure for the files-ng case. Add renderThumbnailFilesNg_ to create that structure. Add notes to remove renderThumbnail_ used by non-files-ng case. Update to code to render the files-ng or non-files-ng drag thumbnails. For the files-ng RTL case, move the drag image grab point to the right by its clientWidth, scaled by the device pixel ratio, to satisfy dragStartEvent.dataTransfer.setDragImage(element, x, y) whose x,y co-ords work in screen units, rather than device independent co-ords like CSS pixel (px) units. For touch initiated drags, there is no need to reposition in the y-direction since the files-ng design has enough room to avoid a finger obscuring the drag drop chip content. Add code comments about "dropping directories on themselves", and code a plain for-loop over the selection Array rather than Array.find(). It is easier to reason about, and it is faster. Saves a function call per loop iteration and it helps if the code is fast since it's called from a drag event handler. Bug: 1002394 Change-Id: I1befcb6f69eca1c7f64591fbf0aca6bb0a69448e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247987Reviewed-by:Luciano Pacheco <lucmult@chromium.org> Reviewed-by:
Alex Danilo <adanilo@chromium.org> Reviewed-by:
Noel Gordon <noel@chromium.org> Commit-Queue: Noel Gordon <noel@chromium.org> Cr-Commit-Position: refs/heads/master@{#779690}
Showing
Please register or sign in to comment