B2G/gecko/browser/components/tabview/tabitems.js
// tab thumbnail in the zoom animation.
tab thumbnail in the zoom animation.
tab thumbnail in the zoom animation .
function TabItem_getZoomTransform(scaleCheat) {
    let { left, top, width, height, right, bottom } = this.$container.bounds();
    let { innerWidth: windowWidth, innerHeight: windowHeight } = window;
    if (!scaleCheat)
      scaleCheat = 1.7;
    let zoomWidth = width + (window.innerWidth - width) / scaleCheat;
    let zoomScaleFactor = zoomWidth / width;
    let zoomHeight = height * zoomScaleFactor;
    let zoomTop = top * (1 - 1/scaleCheat);
    let zoomLeft = left * (1 - 1/scaleCheat);
    let xOrigin = (left - zoomLeft) / ((left - zoomLeft) + (zoomLeft + zoomWidth - right)) * 100;
    let yOrigin = (top - zoomTop) / ((top - zoomTop) + (zoomTop + zoomHeight - bottom)) * 100;
    return {
      transformOrigin: xOrigin + "% " + yOrigin + "%",
      transform: "scale(" + zoomScaleFactor + ")"
    };
  }
function TabItem_getZoomTransform ( scaleCheat ) { let { left , top , width , height , right , bottom } = this . $container . bounds ( ) ; let { innerWidth : windowWidth , innerHeight : windowHeight } = window ; if ( ! scaleCheat ) scaleCheat = 1.7 ; let zoomWidth = width + ( window . innerWidth - width ) / scaleCheat ; let zoomScaleFactor = zoomWidth / width ; let zoomHeight = height * zoomScaleFactor ; let zoomTop = top * ( 1 - 1 / scaleCheat ) ; let zoomLeft = left * ( 1 - 1 / scaleCheat ) ; let xOrigin = ( left - zoomLeft ) / ( ( left - zoomLeft ) + ( zoomLeft + zoomWidth - right ) ) * 100 ; let yOrigin = ( top - zoomTop ) / ( ( top - zoomTop ) + ( zoomTop + zoomHeight - bottom ) ) * 100 ; return { transformOrigin : xOrigin + "% " + yOrigin + "%" , transform : "scale(" + zoomScaleFactor + ")" } ; }
tab thumbnail in the zoom animation.
tab thumbnail in the zoom animation .
// Taking the bounds of the container (as opposed to the canvas) makes us // immune to any transformations applied to the canvas. // The scaleCheat is a clever way to speed up the zoom-in code. // Because image scaling is slowest on big images, we cheat and stop // the image at scaled-down size and placed accordingly. Because the // animation is fast, you can't see the difference but it feels a lot // zippier. The only trick is choosing the right animation function so // that you don't see a change in percieved animation speed from frame #1 // (the tab) to frame #2 (the half-size image) to frame #3 (the first frame // of real animation). Choosing an animation that starts fast is key.