提交 b0a708d4 编写于 作者: H hdx

overflow-visible-event: 调整 getBoundingClientRectAsync

上级 af378c99
......@@ -97,8 +97,8 @@
this.jest_result = true;
}
},
jest_getRect() {
const rect = uni.getElementById('child')?.getBoundingClientRect()
async jest_getRect() {
const rect = await uni.getElementById('child')!.getBoundingClientRectAsync()
if (rect != null) {
let ratio = 1
if (uni.getSystemInfoSync().platform == 'android'){
......@@ -120,8 +120,8 @@
this.jest_parent_top = Math.round((parseFloat(value) * ratio))
}
},
jest_getAbsoluteViewRect() {
const rect = uni.getElementById('absolute-view')?.getBoundingClientRect()
async jest_getAbsoluteViewRect() {
const rect = await uni.getElementById('absolute-view')!.getBoundingClientRectAsync()
if (rect != null) {
const systemInfo = uni.getSystemInfoSync()
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
......@@ -133,9 +133,9 @@
this.jest_click_y = (rect.top + titleBarHeight) * ratio + 30
}
},
jest_scrollToDeepOverflow() {
async jest_scrollToDeepOverflow() {
const scrollView = uni.getElementById('scroll-view') as UniScrollViewElement
const rect = uni.getElementById('deep-overflow')?.getBoundingClientRect()
const rect = await uni.getElementById('deep-overflow')!.getBoundingClientRectAsync()
if (rect != null) {
scrollView.scrollTo(0, rect.top)
setTimeout(() => {
......@@ -145,11 +145,12 @@
ratio = uni.getSystemInfoSync().devicePixelRatio
}
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const afterRect = uni.getElementById('deep-overflow')?.getBoundingClientRect()
uni.getElementById('deep-overflow')!.getBoundingClientRectAsync().then((afterRect: DOMRect) => {
if (afterRect != null) {
this.jest_click_x = afterRect.x * ratio + 30
this.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30
}
})
}, 200)
}
}
......
......@@ -120,7 +120,7 @@
async calcInputRemainHeight() {
let windowHeight = uni.getWindowInfo().windowHeight
const rect = await uni.getElementById('input')!.getBoundingClientRectAsync()
this.inputRemainHeight = windowHeight - rect.bottom ?? windowHeight
this.inputRemainHeight = windowHeight - rect.bottom
}
},
onReady() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册