提交 282951bc 编写于 作者: H hdx

fix(overflow-visible-event): 代码警告问题

上级 0bec2cfe
...@@ -99,14 +99,12 @@ ...@@ -99,14 +99,12 @@
}, },
async jest_getRect() { async jest_getRect() {
const rect = await uni.getElementById('child')!.getBoundingClientRectAsync() const rect = await uni.getElementById('child')!.getBoundingClientRectAsync()
if (rect != null) { let ratio = 1
let ratio = 1 if (uni.getSystemInfoSync().platform == 'android'){
if (uni.getSystemInfoSync().platform == 'android'){ ratio = uni.getSystemInfoSync().devicePixelRatio
ratio = uni.getSystemInfoSync().devicePixelRatio }
} this.jest_click_x = rect.x * ratio + 30
this.jest_click_x = rect.x * ratio + 30 this.jest_click_y = rect.bottom * ratio - 30
this.jest_click_y = rect.bottom * ratio - 30
}
}, },
jest_getParentRect() { jest_getParentRect() {
const transform = uni.getElementById('parent')?.style.getPropertyValue("transform") const transform = uni.getElementById('parent')?.style.getPropertyValue("transform")
...@@ -122,37 +120,31 @@ ...@@ -122,37 +120,31 @@
}, },
async jest_getAbsoluteViewRect() { async jest_getAbsoluteViewRect() {
const rect = await uni.getElementById('absolute-view')!.getBoundingClientRectAsync() const rect = await uni.getElementById('absolute-view')!.getBoundingClientRectAsync()
if (rect != null) { const systemInfo = uni.getSystemInfoSync()
const systemInfo = uni.getSystemInfoSync() const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight let ratio = 1
let ratio = 1 if (uni.getSystemInfoSync().platform == 'android'){
if (uni.getSystemInfoSync().platform == 'android'){ ratio = uni.getSystemInfoSync().devicePixelRatio
ratio = uni.getSystemInfoSync().devicePixelRatio
}
this.jest_click_x = rect.x * ratio + 30
this.jest_click_y = (rect.top + titleBarHeight) * ratio + 30
} }
this.jest_click_x = rect.x * ratio + 30
this.jest_click_y = (rect.top + titleBarHeight) * ratio + 30
}, },
async jest_scrollToDeepOverflow() { async jest_scrollToDeepOverflow() {
const scrollView = uni.getElementById('scroll-view') as UniScrollViewElement const scrollView = uni.getElementById('scroll-view') as UniScrollViewElement
const rect = await uni.getElementById('deep-overflow')!.getBoundingClientRectAsync() const rect = await uni.getElementById('deep-overflow')!.getBoundingClientRectAsync()
if (rect != null) { scrollView.scrollTo(0, rect.top)
scrollView.scrollTo(0, rect.top) setTimeout(() => {
setTimeout(() => { const systemInfo = uni.getSystemInfoSync()
const systemInfo = uni.getSystemInfoSync() let ratio = 1
let ratio = 1 if (uni.getSystemInfoSync().platform == 'android'){
if (uni.getSystemInfoSync().platform == 'android'){ ratio = uni.getSystemInfoSync().devicePixelRatio
ratio = uni.getSystemInfoSync().devicePixelRatio }
} const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight uni.getElementById('deep-overflow')!.getBoundingClientRectAsync().then((afterRect: DOMRect) => {
uni.getElementById('deep-overflow')!.getBoundingClientRectAsync().then((afterRect: DOMRect) => { this.jest_click_x = afterRect.x * ratio + 30
if (afterRect != null) { this.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30
this.jest_click_x = afterRect.x * ratio + 30 })
this.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30 }, 200)
}
})
}, 200)
}
} }
} }
} }
......
...@@ -799,12 +799,12 @@ ...@@ -799,12 +799,12 @@
const x4 = x1 + wavelength; const x4 = x1 + wavelength;
const y4 = y1; const y4 = y1;
context.moveTo(x1, y1); context.moveTo(x1, y1);
path2D!.bezierCurveTo(x2, y2, x3, y3, x4, y4); path2D.bezierCurveTo(x2, y2, x3, y3, x4, y4);
} }
context.stroke(path2D); context.stroke(path2D);
const path2DRect = this.canvasContext!.createPath2D(); const path2DRect = this.canvasContext!.createPath2D();
path2DRect!.rect(10, 10, 100, 20); path2DRect.rect(10, 10, 100, 20);
context.fill(path2DRect); context.fill(path2DRect);
}, },
fontTTF() { fontTTF() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册