]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
refactor: remove the deprecated GetOffsets method and some unused code
authorDaniel Ruf <daniel@daniel-ruf.de>
Sat, 23 Feb 2019 22:57:40 +0000 (23:57 +0100)
committerDaniel Ruf <daniel@daniel-ruf.de>
Sat, 23 Feb 2019 22:57:40 +0000 (23:57 +0100)
js/foundation.positionable.js
js/foundation.util.box.js

index 467279447e32910495d63edb59767d35b0a3ff63..9ca87d7c99e1460c82543243c1da9f146e3f0e1e 100644 (file)
@@ -117,12 +117,8 @@ class Positionable extends Plugin {
     return this.options.hOffset;
   }
 
-
   _setPosition($anchor, $element, $parent) {
     if($anchor.attr('aria-expanded') === 'false'){ return false; }
-    var $eleDims = Box.GetDimensions($element),
-        $anchorDims = Box.GetDimensions($anchor);
-
 
     if (!this.options.allowOverlap) {
       // restore original position & alignment before checking overlap
@@ -133,7 +129,6 @@ class Positionable extends Plugin {
     $element.offset(Box.GetExplicitOffsets($element, $anchor, this.position, this.alignment, this._getVOffset(), this._getHOffset()));
 
     if(!this.options.allowOverlap) {
-      var overlaps = {};
       var minOverlap = 100000000;
       // default coordinates to how we start, in case we can't figure out better
       var minCoordinates = {position: this.position, alignment: this.alignment};
index 71646dae74abd097a7622ce7f4bf7aacf7948e14..625c46c06165a006889c942fcc49f840145a002f 100644 (file)
@@ -119,57 +119,6 @@ function GetDimensions(elem){
  * @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset.
  * TODO alter/rewrite to work with `em` values as well/instead of pixels
  */
-function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) {
-  console.log("NOTE: GetOffsets is deprecated in favor of GetExplicitOffsets and will be removed in 6.5");
-  switch (position) {
-    case 'top':
-      return Rtl() ?
-        GetExplicitOffsets(element, anchor, 'top', 'left', vOffset, hOffset, isOverflow) :
-        GetExplicitOffsets(element, anchor, 'top', 'right', vOffset, hOffset, isOverflow);
-    case 'bottom':
-      return Rtl() ?
-        GetExplicitOffsets(element, anchor, 'bottom', 'left', vOffset, hOffset, isOverflow) :
-        GetExplicitOffsets(element, anchor, 'bottom', 'right', vOffset, hOffset, isOverflow);
-    case 'center top':
-      return GetExplicitOffsets(element, anchor, 'top', 'center', vOffset, hOffset, isOverflow);
-    case 'center bottom':
-      return GetExplicitOffsets(element, anchor, 'bottom', 'center', vOffset, hOffset, isOverflow);
-    case 'center left':
-      return GetExplicitOffsets(element, anchor, 'left', 'center', vOffset, hOffset, isOverflow);
-    case 'center right':
-      return GetExplicitOffsets(element, anchor, 'right', 'center', vOffset, hOffset, isOverflow);
-    case 'left bottom':
-      return GetExplicitOffsets(element, anchor, 'bottom', 'left', vOffset, hOffset, isOverflow);
-    case 'right bottom':
-      return GetExplicitOffsets(element, anchor, 'bottom', 'right', vOffset, hOffset, isOverflow);
-    // Backwards compatibility... this along with the reveal and reveal full
-    // classes are the only ones that didn't reference anchor
-    case 'center':
-      return {
-        left: ($eleDims.windowDims.offset.left + ($eleDims.windowDims.width / 2)) - ($eleDims.width / 2) + hOffset,
-        top: ($eleDims.windowDims.offset.top + ($eleDims.windowDims.height / 2)) - ($eleDims.height / 2 + vOffset)
-      }
-    case 'reveal':
-      return {
-        left: ($eleDims.windowDims.width - $eleDims.width) / 2 + hOffset,
-        top: $eleDims.windowDims.offset.top + vOffset
-      }
-    case 'reveal full':
-      return {
-        left: $eleDims.windowDims.offset.left,
-        top: $eleDims.windowDims.offset.top
-      }
-      break;
-    default:
-      return {
-        left: (Rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width - hOffset: $anchorDims.offset.left + hOffset),
-        top: $anchorDims.offset.top + $anchorDims.height + vOffset
-      }
-
-  }
-
-}
-
 function GetExplicitOffsets(element, anchor, position, alignment, vOffset, hOffset, isOverflow) {
   var $eleDims = GetDimensions(element),
       $anchorDims = anchor ? GetDimensions(anchor) : null;