diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-25 13:13:57 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-25 13:13:57 +0100 |
| commit | d25ff2bddd44b9dac1ceb248424109d1782dd211 (patch) | |
| tree | 34fcfd824a1a72e7b4d431b688adcea532b62180 /minionlivesmatter/templates/assets/tether/src/js/abutment.js | |
| parent | a2cbdd1b88ac723e5e441c0a3c22636f0a8c4dfd (diff) | |
| download | meta-d25ff2bddd44b9dac1ceb248424109d1782dd211.tar.gz meta-d25ff2bddd44b9dac1ceb248424109d1782dd211.zip | |
add minionlivesmatter as submodule
Diffstat (limited to 'minionlivesmatter/templates/assets/tether/src/js/abutment.js')
| -rw-r--r-- | minionlivesmatter/templates/assets/tether/src/js/abutment.js | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/minionlivesmatter/templates/assets/tether/src/js/abutment.js b/minionlivesmatter/templates/assets/tether/src/js/abutment.js deleted file mode 100644 index 9605635..0000000 --- a/minionlivesmatter/templates/assets/tether/src/js/abutment.js +++ /dev/null @@ -1,61 +0,0 @@ -/* globals TetherBase */ - -const {getBounds, updateClasses, defer} = TetherBase.Utils; - -TetherBase.modules.push({ - position({top, left}) { - const {height, width} = this.cache('element-bounds', () => { - return getBounds(this.element); - }); - - const targetPos = this.getTargetBounds(); - - const bottom = top + height; - const right = left + width; - - const abutted = []; - if (top <= targetPos.bottom && bottom >= targetPos.top) { - ['left', 'right'].forEach(side => { - const targetPosSide = targetPos[side]; - if (targetPosSide === left || targetPosSide === right) { - abutted.push(side); - } - }); - } - - if (left <= targetPos.right && right >= targetPos.left) { - ['top', 'bottom'].forEach(side => { - const targetPosSide = targetPos[side]; - if (targetPosSide === top || targetPosSide === bottom) { - abutted.push(side); - } - }); - } - - const allClasses = []; - const addClasses = []; - - const sides = ['left', 'top', 'right', 'bottom']; - allClasses.push(this.getClass('abutted')); - sides.forEach(side => { - allClasses.push(`${ this.getClass('abutted') }-${ side }`); - }); - - if (abutted.length) { - addClasses.push(this.getClass('abutted')); - } - - abutted.forEach(side => { - addClasses.push(`${ this.getClass('abutted') }-${ side }`); - }); - - defer(() => { - if (!(this.options.addTargetClasses === false)) { - updateClasses(this.target, addClasses, allClasses); - } - updateClasses(this.element, addClasses, allClasses); - }); - - return true; - } -}); |
