@dolphinweex/weex-harmony 0.1.91 → 0.1.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -215,15 +215,18 @@ export default {
|
|
|
215
215
|
|
|
216
216
|
children.forEach((child, index) => {
|
|
217
217
|
const rect = child.getBoundingClientRect();
|
|
218
|
-
|
|
218
|
+
// 转换为相对于父元素的坐标,避免视口绝对坐标中负 top 导致高度被持续放大
|
|
219
|
+
const relTop = rect.top - parentRect.top;
|
|
220
|
+
const relBottom = rect.bottom - parentRect.top;
|
|
221
|
+
this.debugLog(`子级 ${index}: top=${relTop}, bottom=${relBottom}, height=${rect.height}`);
|
|
219
222
|
if (rect.height > 0) {
|
|
220
|
-
maxBottom = Math.max(maxBottom,
|
|
221
|
-
minTop = Math.min(minTop,
|
|
223
|
+
maxBottom = Math.max(maxBottom, relBottom);
|
|
224
|
+
minTop = Math.min(minTop, Math.max(0, relTop)); // 负偏移从0算起,不向上扩展
|
|
222
225
|
}
|
|
223
226
|
totalOffsetHeight += (child.offsetHeight || 0);
|
|
224
227
|
});
|
|
225
228
|
|
|
226
|
-
//
|
|
229
|
+
// 优先使用相对坐标计算高度,不受视口滚动或容器偏移影响
|
|
227
230
|
let height = (maxBottom > minTop) ? (maxBottom - minTop) : 0;
|
|
228
231
|
|
|
229
232
|
this.debugLog(`计算高度详情: rectHeight=${height}, totalOffsetHeight=${totalOffsetHeight}, parentRectTop=${parentRect.top}`);
|