B2G/gaia/apps/homescreen/js/page.js
/*
   * This method is invoked when the drag gesture finishes
   */
This method is invoked when the drag gesture finishes
This method is invoked when the drag gesture finishes
function icon_onDragStop(callback) {
    var container = this.container;
    var rect = container.getBoundingClientRect();
    var x = (Math.abs(rect.left + rect.right) / 2) % window.innerWidth;
    x -= this.initXCenter;
    var y = (rect.top + rect.bottom) / 2 +
            (this.initHeight - (rect.bottom - rect.top)) / 2;
    y -= this.initYCenter;
    var draggableElem = this.draggableElem;
    var style = draggableElem.style;
    style.MozTransition = '-moz-transform .4s';
    style.MozTransform = 'translate(' + x + 'px,' + y + 'px)';
    var finishDrag = function() {
      delete container.dataset.dragging;
      if (draggableElem) {
        var img = draggableElem.querySelector('img');
        window.URL.revokeObjectURL(img.src);
        draggableElem.parentNode.removeChild(draggableElem);
      }
      callback();
    };
    var fallbackID = window.setTimeout(function() {
      fallbackID = null;
      finishDrag();
    }, this.FALLBACK_DRAG_STOP_DELAY);
    var content = draggableElem.querySelector('div');
    content.style.MozTransform = 'scale(1)';
    content.addEventListener('transitionend', function tEnd(e) {
      e.target.removeEventListener('transitionend', tEnd);
      if (fallbackID !== null) {
        window.clearTimeout(fallbackID);
        finishDrag();
      }
    });
  }
function icon_onDragStop ( callback ) { var container = this . container ; var rect = container . getBoundingClientRect ( ) ; var x = ( Math . abs ( rect . left + rect . right ) / 2 ) % window . innerWidth ; x -= this . initXCenter ; var y = ( rect . top + rect . bottom ) / 2 + ( this . initHeight - ( rect . bottom - rect . top ) ) / 2 ; y -= this . initYCenter ; var draggableElem = this . draggableElem ; var style = draggableElem . style ; style . MozTransition = '-moz-transform .4s' ; style . MozTransform = 'translate(' + x + 'px,' + y + 'px)' ; var finishDrag = function ( ) { delete container . dataset . dragging ; if ( draggableElem ) { var img = draggableElem . querySelector ( 'img' ) ; window . URL . revokeObjectURL ( img . src ) ; draggableElem . parentNode . removeChild ( draggableElem ) ; } callback ( ) ; } ; var fallbackID = window . setTimeout ( function ( ) { fallbackID = null ; finishDrag ( ) ; } , this . FALLBACK_DRAG_STOP_DELAY ) ; var content = draggableElem . querySelector ( 'div' ) ; content . style . MozTransform = 'scale(1)' ; content . addEventListener ( 'transitionend' , function tEnd ( e ) { e . target . removeEventListener ( 'transitionend' , tEnd ) ; if ( fallbackID !== null ) { window . clearTimeout ( fallbackID ) ; finishDrag ( ) ; } } ) ; }
This method is invoked when the drag gesture finishes
This method is invoked when the drag gesture finishes
// We ensure that there is not an icon lost on the grid