kamrify commited on
Commit
00da064
·
1 Parent(s): 1923a66

Fix - Scroll not working

Browse files
Files changed (1) hide show
  1. src/core/element.js +5 -5
src/core/element.js CHANGED
@@ -77,7 +77,7 @@ export default class Element {
77
  return;
78
  }
79
 
80
- const elementRect = this.getCalculatedPosition();
81
  const absoluteElementTop = elementRect.top + this.window.pageYOffset;
82
  const middle = absoluteElementTop - (this.window.innerHeight / 2);
83
 
@@ -152,13 +152,13 @@ export default class Element {
152
  // If this element is not already highlighted (because this call could
153
  // be from the resize or scroll) and is not in view
154
  if (highlightedNode !== lastHighlightedNode) {
155
- if (!highlightedElement.isInView()) {
156
- highlightedElement.bringInView();
157
- }
158
-
159
  if (popoverElement && !popoverElement.isInView()) {
160
  popoverElement.bringInView();
161
  }
 
 
 
 
162
  }
163
  }
164
 
 
77
  return;
78
  }
79
 
80
+ const elementRect = this.node.getBoundingClientRect();
81
  const absoluteElementTop = elementRect.top + this.window.pageYOffset;
82
  const middle = absoluteElementTop - (this.window.innerHeight / 2);
83
 
 
152
  // If this element is not already highlighted (because this call could
153
  // be from the resize or scroll) and is not in view
154
  if (highlightedNode !== lastHighlightedNode) {
 
 
 
 
155
  if (popoverElement && !popoverElement.isInView()) {
156
  popoverElement.bringInView();
157
  }
158
+
159
+ if (!highlightedElement.isInView()) {
160
+ highlightedElement.bringInView();
161
+ }
162
  }
163
  }
164