From 8f9a66685a09aab075ee0add7cff8c6048fcf963 Mon Sep 17 00:00:00 2001 From: chenzhensheng79 <15118029047@139.com> Date: Mon, 13 Jan 2025 16:07:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3mediaQuery?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=9A=84=E4=BF=A1=E6=81=AF=E4=B8=AD=E7=BC=BA?= =?UTF-8?q?=E5=B0=91physicalTouchSlop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiaozn --- .../flutter/src/main/ets/view/FlutterView.ets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets index c38327f4fb..2bba872962 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets @@ -204,6 +204,8 @@ export class FlutterView { this.id = viewId this.displayInfo = display.getDefaultDisplaySync(); this.viewportMetrics.devicePixelRatio = this.displayInfo?.densityPixels; + this.viewportMetrics.physicalTouchSlop = 1.0 * this.displayInfo?.densityPixels; + this.buildDisplayFeatures(display.getFoldStatus()); this.mainWindow = FlutterManager.getInstance() .getWindowStage(FlutterManager.getInstance().getUIAbility(context)) @@ -237,6 +239,7 @@ export class FlutterView { this.displayInfo = display.getDefaultDisplaySync(); if (this.viewportMetrics.devicePixelRatio != this.displayInfo?.densityPixels) { this.viewportMetrics.devicePixelRatio = this.displayInfo?.densityPixels; + this.viewportMetrics.physicalTouchSlop = 1.0 * this.displayInfo?.densityPixels; Log.i(TAG, "Display on: " + JSON.stringify(this.displayInfo)) this.updateViewportMetrics() } @@ -393,6 +396,7 @@ export class FlutterView { display.off("change", ()=>{ this.displayInfo = display.getDefaultDisplaySync(); this.viewportMetrics.devicePixelRatio = this.displayInfo?.densityPixels; + this.viewportMetrics.physicalTouchSlop = 1.0 * this.displayInfo?.densityPixels; Log.i(TAG, "Display Info: " + JSON.stringify(this.displayInfo)) this.updateViewportMetrics() }); -- Gitee From 30a8fd7d991cc3e2b2b11bdfaae337afa3a5ee4d Mon Sep 17 00:00:00 2001 From: chenzhensheng79 <15118029047@139.com> Date: Thu, 16 Jan 2025 11:37:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20mediaQuery=E6=9A=82=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81physicalTouchSlop=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiaozn --- README.md | 4 ++-- .../flutter/src/main/ets/view/FlutterView.ets | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 98c2d798a4..2ee2ac6fa5 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,6 @@ Flutter Engine 5. 由于windows和Linux、Mac对换行符处理方式不同,在应用dart补丁时会造成dart vm snapshot hash结果不同,可通过以下方法获取当前snapshot hash值 -6. MediaQuery组件暂不支持displayFeatureType和displayFeatureState信息 - ```shell python xxx/src/third_party/dart/tools/make_version.py --format='{{SNAPSHOT_HASH}}' ``` @@ -118,3 +116,5 @@ Flutter Engine 其中xxx为创建的engine路径 如果获取到的值不是“8af474944053df1f0a3be6e6165fa7cf”那么就需要检查`xxx/src/third_party/dart/runtime/vm/dart.cc`文件和`xxx/src/third_party/dart/runtime/vm/image_snapshot.cc`文件中全部行的结尾是不是以LF结尾的,windows可以使用notepad++查看,其它系统具体方法请自行查询 + +6. MediaQuery组件暂不支持gestureSettings.DeviceGesturesetting、displayFeatureType和displayFeatureState信息 diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets index fec9d8337f..f402b642b7 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/view/FlutterView.ets @@ -202,7 +202,6 @@ export class FlutterView { this.id = viewId this.displayInfo = display.getDefaultDisplaySync(); this.viewportMetrics.devicePixelRatio = this.displayInfo?.densityPixels; - this.viewportMetrics.physicalTouchSlop = 1.0 * this.displayInfo?.densityPixels; this.buildDisplayFeatures(display.getFoldStatus()); this.mainWindow = FlutterManager.getInstance() @@ -237,7 +236,6 @@ export class FlutterView { this.displayInfo = display.getDefaultDisplaySync(); if (this.viewportMetrics.devicePixelRatio != this.displayInfo?.densityPixels) { this.viewportMetrics.devicePixelRatio = this.displayInfo?.densityPixels; - this.viewportMetrics.physicalTouchSlop = 1.0 * this.displayInfo?.densityPixels; Log.i(TAG, "Display on: " + JSON.stringify(this.displayInfo)) this.updateViewportMetrics() } @@ -394,7 +392,6 @@ export class FlutterView { display.off("change", ()=>{ this.displayInfo = display.getDefaultDisplaySync(); this.viewportMetrics.devicePixelRatio = this.displayInfo?.densityPixels; - this.viewportMetrics.physicalTouchSlop = 1.0 * this.displayInfo?.densityPixels; Log.i(TAG, "Display Info: " + JSON.stringify(this.displayInfo)) this.updateViewportMetrics() }); -- Gitee