js: Stop using {v,h}scroll properties
We only use them to access the corresponding adjustments, and ScrollView now exposes those directly. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
This commit is contained in:
parent
a63d5b6b09
commit
998d703bc2
@ -128,7 +128,7 @@ export const AuthList = GObject.registerClass({
|
|||||||
scrollToItem(item) {
|
scrollToItem(item) {
|
||||||
let box = item.get_allocation_box();
|
let box = item.get_allocation_box();
|
||||||
|
|
||||||
const {adjustment} = this._scrollView.vscroll;
|
const adjustment = this._scrollView.vadjustment;
|
||||||
|
|
||||||
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
||||||
adjustment.ease(value, {
|
adjustment.ease(value, {
|
||||||
|
@ -224,7 +224,7 @@ const UserList = GObject.registerClass({
|
|||||||
scrollToItem(item) {
|
scrollToItem(item) {
|
||||||
let box = item.get_allocation_box();
|
let box = item.get_allocation_box();
|
||||||
|
|
||||||
const {adjustment} = this.vscroll;
|
const adjustment = this.vadjustment;
|
||||||
|
|
||||||
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
||||||
adjustment.ease(value, {
|
adjustment.ease(value, {
|
||||||
@ -236,7 +236,7 @@ const UserList = GObject.registerClass({
|
|||||||
jumpToItem(item) {
|
jumpToItem(item) {
|
||||||
let box = item.get_allocation_box();
|
let box = item.get_allocation_box();
|
||||||
|
|
||||||
const {adjustment} = this.vscroll;
|
const adjustment = this.vadjustment;
|
||||||
|
|
||||||
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ export function adjustAnimationTime(msecs) {
|
|||||||
* @param {Clutter.Actor} actor - the actor
|
* @param {Clutter.Actor} actor - the actor
|
||||||
*/
|
*/
|
||||||
export function ensureActorVisibleInScrollView(scrollView, actor) {
|
export function ensureActorVisibleInScrollView(scrollView, actor) {
|
||||||
const {adjustment} = scrollView.vscroll;
|
const adjustment = scrollView.vadjustment;
|
||||||
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
|
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
|
||||||
|
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
@ -529,8 +529,7 @@ var BaseAppView = GObject.registerClass({
|
|||||||
this._scrollTimeoutId = 0;
|
this._scrollTimeoutId = 0;
|
||||||
this._scrollView.connect('scroll-event', this._onScroll.bind(this));
|
this._scrollView.connect('scroll-event', this._onScroll.bind(this));
|
||||||
|
|
||||||
const scroll = this._scrollView.hscroll;
|
this._adjustment = this._scrollView.hadjustment;
|
||||||
this._adjustment = scroll.adjustment;
|
|
||||||
this._adjustment.connect('notify::value', adj => {
|
this._adjustment.connect('notify::value', adj => {
|
||||||
const value = adj.value / adj.page_size;
|
const value = adj.value / adj.page_size;
|
||||||
this._pageIndicators.setCurrentPosition(value);
|
this._pageIndicators.setCurrentPosition(value);
|
||||||
@ -2375,7 +2374,7 @@ export const FolderIcon = GObject.registerClass({
|
|||||||
|
|
||||||
open() {
|
open() {
|
||||||
this._ensureFolderDialog();
|
this._ensureFolderDialog();
|
||||||
this.view._scrollView.vscroll.adjustment.value = 0;
|
this.view._scrollView.vadjustment.value = 0;
|
||||||
this._dialog.popup();
|
this._dialog.popup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -890,8 +890,8 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
|
|||||||
// Keep track of the bottom position for the current adjustment and
|
// Keep track of the bottom position for the current adjustment and
|
||||||
// force a scroll to the bottom if things change while we were at the
|
// force a scroll to the bottom if things change while we were at the
|
||||||
// bottom
|
// bottom
|
||||||
this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
|
this._oldMaxScrollValue = this._scrollArea.vadjustment.value;
|
||||||
this._scrollArea.vscroll.adjustment.connect('changed', adjustment => {
|
this._scrollArea.vadjustment.connect('changed', adjustment => {
|
||||||
if (adjustment.value === this._oldMaxScrollValue)
|
if (adjustment.value === this._oldMaxScrollValue)
|
||||||
this.scrollTo(St.Side.BOTTOM);
|
this.scrollTo(St.Side.BOTTOM);
|
||||||
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
|
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
|
||||||
@ -917,7 +917,7 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scrollTo(side) {
|
scrollTo(side) {
|
||||||
let adjustment = this._scrollArea.vscroll.adjustment;
|
let adjustment = this._scrollArea.vadjustment;
|
||||||
if (side === St.Side.TOP)
|
if (side === St.Side.TOP)
|
||||||
adjustment.value = adjustment.lower;
|
adjustment.value = adjustment.lower;
|
||||||
else if (side === St.Side.BOTTOM)
|
else if (side === St.Side.BOTTOM)
|
||||||
|
@ -179,7 +179,7 @@ const Notebook = GObject.registerClass({
|
|||||||
scrollview.hide();
|
scrollview.hide();
|
||||||
this.add_child(scrollview);
|
this.add_child(scrollview);
|
||||||
|
|
||||||
let vAdjust = scrollview.vscroll.adjustment;
|
const vAdjust = scrollview.vadjustment;
|
||||||
vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData));
|
vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData));
|
||||||
vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData));
|
vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData));
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ const Notebook = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onAdjustValueChanged(tabData) {
|
_onAdjustValueChanged(tabData) {
|
||||||
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
const vAdjust = tabData.scrollView.vadjustment;
|
||||||
if (vAdjust.value < (vAdjust.upper - vAdjust.lower - 0.5))
|
if (vAdjust.value < (vAdjust.upper - vAdjust.lower - 0.5))
|
||||||
tabData._scrolltoBottom = false;
|
tabData._scrolltoBottom = false;
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ const Notebook = GObject.registerClass({
|
|||||||
_onAdjustScopeChanged(tabData) {
|
_onAdjustScopeChanged(tabData) {
|
||||||
if (!tabData._scrollToBottom)
|
if (!tabData._scrollToBottom)
|
||||||
return;
|
return;
|
||||||
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
const vAdjust = tabData.scrollView.vadjustment;
|
||||||
vAdjust.value = vAdjust.upper - vAdjust.page_size;
|
vAdjust.value = vAdjust.upper - vAdjust.page_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ export const SearchResultsView = GObject.registerClass({
|
|||||||
|
|
||||||
_onPan(action) {
|
_onPan(action) {
|
||||||
let [dist_, dx_, dy] = action.get_motion_delta(0);
|
let [dist_, dx_, dy] = action.get_motion_delta(0);
|
||||||
let adjustment = this._scrollView.vscroll.adjustment;
|
let adjustment = this._scrollView.vadjustment;
|
||||||
adjustment.value -= (dy / this.height) * adjustment.page_size;
|
adjustment.value -= (dy / this.height) * adjustment.page_size;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ export const SwitcherList = GObject.registerClass({
|
|||||||
|
|
||||||
this._highlighted = index;
|
this._highlighted = index;
|
||||||
|
|
||||||
let adjustment = this._scrollView.hscroll.adjustment;
|
const adjustment = this._scrollView.hadjustment;
|
||||||
let [value] = adjustment.get_values();
|
let [value] = adjustment.get_values();
|
||||||
let [absItemX] = this._items[index].get_transformed_position();
|
let [absItemX] = this._items[index].get_transformed_position();
|
||||||
let [result_, posX, posY_] = this.transform_stage_point(absItemX, 0);
|
let [result_, posX, posY_] = this.transform_stage_point(absItemX, 0);
|
||||||
@ -513,7 +513,7 @@ export const SwitcherList = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_scrollToLeft(index) {
|
_scrollToLeft(index) {
|
||||||
let adjustment = this._scrollView.hscroll.adjustment;
|
const adjustment = this._scrollView.hadjustment;
|
||||||
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
|
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
|
||||||
|
|
||||||
let item = this._items[index];
|
let item = this._items[index];
|
||||||
@ -536,7 +536,7 @@ export const SwitcherList = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_scrollToRight(index) {
|
_scrollToRight(index) {
|
||||||
let adjustment = this._scrollView.hscroll.adjustment;
|
const adjustment = this._scrollView.hadjustment;
|
||||||
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
|
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
|
||||||
|
|
||||||
let item = this._items[index];
|
let item = this._items[index];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user