gnome/extensions/dash-to-dock@micxgx.gmail.com/dash.js
/**
 * This is a copy of the same function in utils.js, but also adjust horizontal scrolling
 * and perform few further cheks on the current value to avoid changing the values when
 * it would be clamp to the current one in any case.
 * Return the amount of shift applied
 */
This is a copy of the same function in utils.js, but also adjust horizontal scrolling
and perform few further cheks on the current value to avoid changing the values when
it would be clamp to the current one in any case.
Return the amount of shift applied
This is a copy of the same function in utils . js but also adjust horizontal scrolling and perform few further cheks on the current value to avoid changing the values when it would be clamp to the current one in any case . Return the amount of shift applied
function ensureActorVisibleInScrollView(scrollView, actor) {
    let adjust_v = true;
    let adjust_h = true;
    let vadjustment = scrollView.get_vscroll_bar().get_adjustment();
    let hadjustment = scrollView.get_hscroll_bar().get_adjustment();
    let [vvalue, vlower, vupper, vstepIncrement, vpageIncrement, vpageSize] = vadjustment.get_values();
    let [hvalue, hlower, hupper, hstepIncrement, hpageIncrement, hpageSize] = hadjustment.get_values();
    let [hvalue0, vvalue0] = [hvalue, vvalue];
    let voffset = 0;
    let hoffset = 0;
    let fade = scrollView.get_effect('fade');
    if (fade) {
        voffset = fade.vfade_offset;
        hoffset = fade.hfade_offset;
    }
    let box = actor.get_allocation_box();
    let y1 = box.y1, y2 = box.y2, x1 = box.x1, x2 = box.x2;
    let parent = actor.get_parent();
    while (parent != scrollView) {
        if (!parent)
            throw new Error('Actor not in scroll view');
        let box = parent.get_allocation_box();
        y1 += box.y1;
        y2 += box.y1;
        x1 += box.x1;
        x2 += box.x1;
        parent = parent.get_parent();
    }
    if (y1 < vvalue + voffset)
        vvalue = Math.max(0, y1 - voffset);
    else if (vvalue < vupper - vpageSize && y2 > vvalue + vpageSize - voffset)
        vvalue = Math.min(vupper -vpageSize, y2 + voffset - vpageSize);
    if (x1 < hvalue + hoffset)
        hvalue = Math.max(0, x1 - hoffset);
    else if (hvalue < hupper - hpageSize && x2 > hvalue + hpageSize - hoffset)
        hvalue = Math.min(hupper - hpageSize, x2 + hoffset - hpageSize);
    if (vvalue !== vvalue0) {
        vadjustment.ease(vvalue, {
            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
            duration: Util.SCROLL_TIME
        });
    }
    if (hvalue !== hvalue0) {
        hadjustment.ease(hvalue, {
            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
            duration: Util.SCROLL_TIME
        });
    }
    return [hvalue- hvalue0, vvalue - vvalue0];
}
function ensureActorVisibleInScrollView ( scrollView , actor ) { let adjust_v = true ; let adjust_h = true ; let vadjustment = scrollView . get_vscroll_bar ( ) . get_adjustment ( ) ; let hadjustment = scrollView . get_hscroll_bar ( ) . get_adjustment ( ) ; let [ vvalue , vlower , vupper , vstepIncrement , vpageIncrement , vpageSize ] = vadjustment . get_values ( ) ; let [ hvalue , hlower , hupper , hstepIncrement , hpageIncrement , hpageSize ] = hadjustment . get_values ( ) ; let [ hvalue0 , vvalue0 ] = [ hvalue , vvalue ] ; let voffset = 0 ; let hoffset = 0 ; let fade = scrollView . get_effect ( 'fade' ) ; if ( fade ) { voffset = fade . vfade_offset ; hoffset = fade . hfade_offset ; } let box = actor . get_allocation_box ( ) ; let y1 = box . y1 , y2 = box . y2 , x1 = box . x1 , x2 = box . x2 ; let parent = actor . get_parent ( ) ; while ( parent != scrollView ) { if ( ! parent ) throw new Error ( 'Actor not in scroll view' ) ; let box = parent . get_allocation_box ( ) ; y1 += box . y1 ; y2 += box . y1 ; x1 += box . x1 ; x2 += box . x1 ; parent = parent . get_parent ( ) ; } if ( y1 < vvalue + voffset ) vvalue = Math . max ( 0 , y1 - voffset ) ; else if ( vvalue < vupper - vpageSize && y2 > vvalue + vpageSize - voffset ) vvalue = Math . min ( vupper - vpageSize , y2 + voffset - vpageSize ) ; if ( x1 < hvalue + hoffset ) hvalue = Math . max ( 0 , x1 - hoffset ) ; else if ( hvalue < hupper - hpageSize && x2 > hvalue + hpageSize - hoffset ) hvalue = Math . min ( hupper - hpageSize , x2 + hoffset - hpageSize ) ; if ( vvalue !== vvalue0 ) { vadjustment . ease ( vvalue , { mode : Clutter . AnimationMode . EASE_OUT_QUAD , duration : Util . SCROLL_TIME } ) ; } if ( hvalue !== hvalue0 ) { hadjustment . ease ( hvalue , { mode : Clutter . AnimationMode . EASE_OUT_QUAD , duration : Util . SCROLL_TIME } ) ; } return [ hvalue - hvalue0 , vvalue - vvalue0 ] ; }
This is a copy of the same function in utils.js, but also adjust horizontal scrolling
 and perform few further cheks on the current value to avoid changing the values when
 it would be clamp to the current one in any case.
This is a copy of the same function in utils . js but also adjust horizontal scrolling and perform few further cheks on the current value to avoid changing the values when it would be clamp to the current one in any case .