From 05b41f3383aad116a21e14b5b103763c9d34f19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sat, 10 Jun 2023 22:46:17 +0800 Subject: [PATCH] update --- example/qml/window/MainWindow.qml | 36 +++++++++++++++++++------------ 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 846b7f76..b0424a7b 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -243,25 +243,33 @@ CustomWindow { } function handleDarkChanged(button){ - var pos = button.mapToItem(window.contentItem,0,0) - var mouseX = pos.x - var mouseY = pos.y - canvas.maxRadius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,canvas.width,0),distance(mouseX,mouseY,0,canvas.height),distance(mouseX,mouseY,canvas.width,canvas.height)) - window.contentItem.grabToImage(function(result) { - img_cache.source = result.url - canvas.requestPaint() + if(Screen.devicePixelRatio===1){ + var pos = button.mapToItem(window.contentItem,0,0) + var mouseX = pos.x + var mouseY = pos.y + canvas.maxRadius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,canvas.width,0),distance(mouseX,mouseY,0,canvas.height),distance(mouseX,mouseY,canvas.width,canvas.height)) + window.contentItem.grabToImage(function(result) { + img_cache.source = result.url + canvas.requestPaint() + if(FluTheme.dark){ + FluTheme.darkMode = FluDarkMode.Light + }else{ + FluTheme.darkMode = FluDarkMode.Dark + } + canvas.centerX = mouseX + canvas.centerY = mouseY + anim_radius.enabled = false + canvas.radius = 0 + anim_radius.enabled = true + canvas.radius = canvas.maxRadius + }) + }else{ if(FluTheme.dark){ FluTheme.darkMode = FluDarkMode.Light }else{ FluTheme.darkMode = FluDarkMode.Dark } - canvas.centerX = mouseX - canvas.centerY = mouseY - anim_radius.enabled = false - canvas.radius = 0 - anim_radius.enabled = true - canvas.radius = canvas.maxRadius - }) + } } }