From 82a7d42b688297fe9dd720a73640ee4f16c79174 Mon Sep 17 00:00:00 2001 From: samuel <53528911+samuel-jimenez@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:20:58 -0600 Subject: [PATCH] redraw on resize, extract radius --- package/contents/ui/LunaIcon.qml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/package/contents/ui/LunaIcon.qml b/package/contents/ui/LunaIcon.qml index 2ffcaf9..87c420a 100644 --- a/package/contents/ui/LunaIcon.qml +++ b/package/contents/ui/LunaIcon.qml @@ -41,10 +41,13 @@ Item { property bool showTycho: false property bool showCopernicus: false property int theta: 45 // Degrees: 0= new moon, 90= first quarter, 180= full moon, 270= third quarter + property alias radius: lunaBackground.radius Item { id: lunaBackground + property int radius: Math.floor(height / 2) + anchors.centerIn: parent width: Math.min(parent.width, parent.height) height: Math.min(parent.width, parent.height) @@ -92,8 +95,6 @@ Item { strokeWidth: -1 //no stroke PathAngleArc { - property int radius: Math.floor(height / 2) - centerX: radius centerY: radius radiusY: radius @@ -121,10 +122,10 @@ Item { onLatitudeChanged: requestPaint() onThetaChanged: requestPaint() onShowShadowChanged: requestPaint() + onWidthChanged: requestPaint() onPaint: { context.reset(); if (showShadow) { - var radius = Math.floor(height / 2); var cosTheta = Math.cos(theta / 180 * Math.PI); var counterclockwisep = (theta < 180); context.globalAlpha = 0.9; @@ -151,7 +152,6 @@ Item { id: markers property int latitude: lunaIcon.latitude - property int theta: lunaIcon.theta property bool showShadow: lunaIcon.showShadow property bool showGrid: lunaIcon.showGrid property bool showTycho: lunaIcon.showTycho @@ -202,7 +202,6 @@ Item { anchors.centerIn: parent contextType: "2d" onLatitudeChanged: requestPaint() - onThetaChanged: requestPaint() onShowGridChanged: requestPaint() onShowTychoChanged: requestPaint() onShowCopernicusChanged: requestPaint() @@ -210,7 +209,6 @@ Item { onPaint: { context.reset(); if (!showShadow) { - var radius = Math.floor(height / 2); var cosTheta = Math.cos(theta / 180 * Math.PI); var counterclockwisep = (theta < 180); context.globalAlpha = 0.9; @@ -255,8 +253,6 @@ Item { strokeWidth: -1 //no stroke PathAngleArc { - property int radius: Math.floor(height / 2) - centerX: radius centerY: radius radiusY: radius -- GitLab