From 282951bc4c030dc5b58b4bb5f85fbf3c638958a9 Mon Sep 17 00:00:00 2001 From: hdx Date: Tue, 12 Nov 2024 10:43:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(overflow-visible-event):=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=AD=A6=E5=91=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CSS/overflow/overflow-visible-event.uvue | 60 ++++++++----------- pages/component/canvas/canvas-context.uvue | 4 +- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/pages/CSS/overflow/overflow-visible-event.uvue b/pages/CSS/overflow/overflow-visible-event.uvue index d9854339..52f8aba7 100644 --- a/pages/CSS/overflow/overflow-visible-event.uvue +++ b/pages/CSS/overflow/overflow-visible-event.uvue @@ -99,14 +99,12 @@ }, async jest_getRect() { const rect = await uni.getElementById('child')!.getBoundingClientRectAsync() - if (rect != null) { - let ratio = 1 - if (uni.getSystemInfoSync().platform == 'android'){ - ratio = uni.getSystemInfoSync().devicePixelRatio - } - this.jest_click_x = rect.x * ratio + 30 - this.jest_click_y = rect.bottom * ratio - 30 - } + let ratio = 1 + if (uni.getSystemInfoSync().platform == 'android'){ + ratio = uni.getSystemInfoSync().devicePixelRatio + } + this.jest_click_x = rect.x * ratio + 30 + this.jest_click_y = rect.bottom * ratio - 30 }, jest_getParentRect() { const transform = uni.getElementById('parent')?.style.getPropertyValue("transform") @@ -122,37 +120,31 @@ }, async jest_getAbsoluteViewRect() { const rect = await uni.getElementById('absolute-view')!.getBoundingClientRectAsync() - if (rect != null) { - const systemInfo = uni.getSystemInfoSync() - const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight - let ratio = 1 - if (uni.getSystemInfoSync().platform == 'android'){ - ratio = uni.getSystemInfoSync().devicePixelRatio - } - this.jest_click_x = rect.x * ratio + 30 - this.jest_click_y = (rect.top + titleBarHeight) * ratio + 30 + const systemInfo = uni.getSystemInfoSync() + const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight + let ratio = 1 + if (uni.getSystemInfoSync().platform == 'android'){ + ratio = uni.getSystemInfoSync().devicePixelRatio } + this.jest_click_x = rect.x * ratio + 30 + this.jest_click_y = (rect.top + titleBarHeight) * ratio + 30 }, async jest_scrollToDeepOverflow() { const scrollView = uni.getElementById('scroll-view') as UniScrollViewElement const rect = await uni.getElementById('deep-overflow')!.getBoundingClientRectAsync() - if (rect != null) { - scrollView.scrollTo(0, rect.top) - setTimeout(() => { - const systemInfo = uni.getSystemInfoSync() - let ratio = 1 - if (uni.getSystemInfoSync().platform == 'android'){ - ratio = uni.getSystemInfoSync().devicePixelRatio - } - const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight - 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) - } + scrollView.scrollTo(0, rect.top) + setTimeout(() => { + const systemInfo = uni.getSystemInfoSync() + let ratio = 1 + if (uni.getSystemInfoSync().platform == 'android'){ + ratio = uni.getSystemInfoSync().devicePixelRatio + } + const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight + uni.getElementById('deep-overflow')!.getBoundingClientRectAsync().then((afterRect: DOMRect) => { + this.jest_click_x = afterRect.x * ratio + 30 + this.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30 + }) + }, 200) } } } diff --git a/pages/component/canvas/canvas-context.uvue b/pages/component/canvas/canvas-context.uvue index 249b8bd5..0103183a 100644 --- a/pages/component/canvas/canvas-context.uvue +++ b/pages/component/canvas/canvas-context.uvue @@ -799,12 +799,12 @@ const x4 = x1 + wavelength; const y4 = y1; context.moveTo(x1, y1); - path2D!.bezierCurveTo(x2, y2, x3, y3, x4, y4); + path2D.bezierCurveTo(x2, y2, x3, y3, x4, y4); } context.stroke(path2D); const path2DRect = this.canvasContext!.createPath2D(); - path2DRect!.rect(10, 10, 100, 20); + path2DRect.rect(10, 10, 100, 20); context.fill(path2DRect); }, fontTTF() { -- GitLab