Commit a6d49bcb authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

PDF Viewer Update: Scroll thumbnail into view

When the active page changes, scroll the thumbnail into the visible area
of the thumbnail bar.

Bug: 652400
Change-Id: I6333a66b88202b7dabcb1a0f287b3fbee2d3b701
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404564
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806392}
parent 2ad568de
...@@ -19,6 +19,7 @@ export class ViewerThumbnailElement extends PolymerElement { ...@@ -19,6 +19,7 @@ export class ViewerThumbnailElement extends PolymerElement {
return { return {
isActive: { isActive: {
type: Boolean, type: Boolean,
observer: 'isActiveChanged_',
reflectToAttribute: true, reflectToAttribute: true,
}, },
...@@ -26,6 +27,13 @@ export class ViewerThumbnailElement extends PolymerElement { ...@@ -26,6 +27,13 @@ export class ViewerThumbnailElement extends PolymerElement {
}; };
} }
/** @private */
isActiveChanged_() {
if (this.isActive) {
this.scrollIntoView({block: 'nearest'});
}
}
/** @private */ /** @private */
onClick_() { onClick_() {
this.dispatchEvent(new CustomEvent('change-page', { this.dispatchEvent(new CustomEvent('change-page', {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment