pageIndicators: Redesign and add position-based animation
Remove setCurrentPage() function, introduce setCurrentPosition() instead, which allows to have fractional positions. Make inactive dots smaller, filled and partially transparent, as opposed to larger and fully opaque active dot. Make dots smaller overall, remove borders. Interpolate each dot between active and inactive state based on scroll position. Make it impossible to "uncheck" the active dot. Thanks Florian Müllner for parts of the code. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1932 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/843
This commit is contained in:
@ -920,9 +920,14 @@ var EmojiSelection = GObject.registerClass({
|
||||
this.add_child(this._pageIndicator);
|
||||
this._pageIndicator.setReactive(false);
|
||||
|
||||
this._emojiPager.connect('notify::delta', () => {
|
||||
this._updateIndicatorPosition();
|
||||
});
|
||||
|
||||
let bottomRow = this._createBottomRow();
|
||||
this.add_child(bottomRow);
|
||||
|
||||
this._curPage = 0;
|
||||
this._emojiPager.setCurrentPage(0);
|
||||
}
|
||||
|
||||
@ -937,8 +942,9 @@ var EmojiSelection = GObject.registerClass({
|
||||
}
|
||||
|
||||
_onPageChanged(sectionLabel, page, nPages) {
|
||||
this._curPage = page;
|
||||
this._pageIndicator.setNPages(nPages);
|
||||
this._pageIndicator.setCurrentPage(page);
|
||||
this._updateIndicatorPosition();
|
||||
|
||||
for (let i = 0; i < this._sections.length; i++) {
|
||||
let sect = this._sections[i];
|
||||
@ -946,6 +952,11 @@ var EmojiSelection = GObject.registerClass({
|
||||
}
|
||||
}
|
||||
|
||||
_updateIndicatorPosition() {
|
||||
this._pageIndicator.setCurrentPosition(this._curPage -
|
||||
this._emojiPager.delta / this._emojiPager.width);
|
||||
}
|
||||
|
||||
_findSection(emoji) {
|
||||
for (let i = 0; i < this._sections.length; i++) {
|
||||
if (this._sections[i].first == emoji)
|
||||
|
Reference in New Issue
Block a user