Forráskód Böngészése

remove getOuterRect

Adam Shaw 8 éve
szülő
commit
8a8900dbc4
4 módosított fájl, 2 hozzáadás és 22 törlés
  1. 1 2
      src/common/DragListener.ts
  2. 1 2
      src/common/HitDragListener.ts
  3. 0 1
      src/exports.ts
  4. 0 17
      src/util.ts

+ 1 - 2
src/common/DragListener.ts

@@ -10,7 +10,6 @@ import {
   allowSelection,
   preventDefault,
   debounce,
-  getOuterRect,
   proxy
 } from '../util'
 import { default as ListenerMixin, ListenerInterface } from './ListenerMixin'
@@ -373,7 +372,7 @@ export default class DragListener {
   // Computes and stores the bounding rectangle of scrollEl
   computeScrollBounds() {
     if (this.isAutoScroll) {
-      this.scrollBounds = getOuterRect(this.scrollEl)
+      this.scrollBounds = this.scrollEl[0].getBoundingClientRect()
       // TODO: use getClientRect in future. but prevents auto scrolling when on top of scrollbars
     }
   }

+ 1 - 2
src/common/HitDragListener.ts

@@ -1,7 +1,6 @@
 import {
   getEvX,
   getEvY,
-  getOuterRect,
   constrainPoint,
   intersectRects,
   getRectCenter,
@@ -49,7 +48,7 @@ export default class HitDragListener extends DragListener {
 
       // constrain the point to bounds of the element being dragged
       if (subjectEl) {
-        subjectRect = getOuterRect(subjectEl) // used for centering as well
+        subjectRect = subjectEl[0].getBoundingClientRect() // used for centering as well
         point = constrainPoint(point, subjectRect)
       }
 

+ 0 - 1
src/exports.ts

@@ -21,7 +21,6 @@ export {
   cssToStr,
   proxy,
   capitaliseFirstLetter,
-  getOuterRect,
   getClientRect,
   getContentRect,
   getScrollbarWidths,

+ 0 - 17
src/util.ts

@@ -165,23 +165,6 @@ export function getScrollParent(el: JQuery) {
 }
 
 
-// Queries the outer bounding area of a jQuery element.
-// Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
-// Origin is optional.
-export function getOuterRect(el: JQuery, origin?) {
-  let offset = el.offset()
-  let left = offset.left - (origin ? origin.left : 0)
-  let top = offset.top - (origin ? origin.top : 0)
-
-  return {
-    left: left,
-    right: left + el.outerWidth(),
-    top: top,
-    bottom: top + el.outerHeight()
-  }
-}
-
-
 // Queries the area within the margin/border/scrollbars of a jQuery element. Does not go within the padding.
 // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
 // Origin is optional.