|
10 | 10 | */ |
11 | 11 | 'use strict'; |
12 | 12 |
|
13 | | -var nodePos = require('./nodePos'); |
14 | 13 | var setStyle = require('./setStyle'); |
15 | 14 |
|
16 | 15 | import type {DOMNode} from '../types'; |
@@ -86,31 +85,31 @@ class Overlay { |
86 | 85 | } |
87 | 86 |
|
88 | 87 | inspect(node: DOMNode, name?: ?string) { |
89 | | - var pos = nodePos(node); |
| 88 | + var box = node.getBoundingClientRect(); |
90 | 89 | var dims = getElementDimensions(node); |
91 | 90 |
|
92 | 91 | boxWrap(dims, 'margin', this.node); |
93 | 92 | boxWrap(dims, 'border', this.border); |
94 | 93 | boxWrap(dims, 'padding', this.padding); |
95 | 94 |
|
96 | 95 | setStyle(this.content, { |
97 | | - height: node.offsetHeight - dims.borderTop - dims.borderBottom - dims.paddingTop - dims.paddingBottom + 'px', |
98 | | - width: node.offsetWidth - dims.borderLeft - dims.borderRight - dims.paddingLeft - dims.paddingRight + 'px', |
| 96 | + height: box.height - dims.borderTop - dims.borderBottom - dims.paddingTop - dims.paddingBottom + 'px', |
| 97 | + width: box.width - dims.borderLeft - dims.borderRight - dims.paddingLeft - dims.paddingRight + 'px', |
99 | 98 | }); |
100 | 99 |
|
101 | 100 | setStyle(this.node, { |
102 | | - top: pos.top - dims.marginTop + 'px', |
103 | | - left: pos.left - dims.marginLeft + 'px', |
| 101 | + top: box.top - dims.marginTop + 'px', |
| 102 | + left: box.left - dims.marginLeft + 'px', |
104 | 103 | }); |
105 | 104 |
|
106 | 105 | this.nameSpan.textContent = (name || node.nodeName.toLowerCase()); |
107 | | - this.dimSpan.textContent = node.offsetWidth + 'px × ' + node.offsetHeight + 'px'; |
| 106 | + this.dimSpan.textContent = box.width + 'px × ' + box.height + 'px'; |
108 | 107 |
|
109 | 108 | var tipPos = findTipPos({ |
110 | | - top: pos.top - dims.marginTop, |
111 | | - left: pos.left - dims.marginLeft, |
112 | | - height: node.offsetHeight + dims.marginTop + dims.marginBottom, |
113 | | - width: node.offsetWidth + dims.marginLeft + dims.marginRight, |
| 109 | + top: box.top - dims.marginTop, |
| 110 | + left: box.left - dims.marginLeft, |
| 111 | + height: box.height + dims.marginTop + dims.marginBottom, |
| 112 | + width: box.width + dims.marginLeft + dims.marginRight, |
114 | 113 | }, this.win); |
115 | 114 | setStyle(this.tip, tipPos); |
116 | 115 | } |
|
0 commit comments