Skip to content
Snippets Groups Projects
Commit 82a7d42b authored by samuel's avatar samuel
Browse files

redraw on resize, extract radius

parent 064ff9d2
No related branches found
No related tags found
No related merge requests found
...@@ -41,10 +41,13 @@ Item { ...@@ -41,10 +41,13 @@ Item {
property bool showTycho: false property bool showTycho: false
property bool showCopernicus: false property bool showCopernicus: false
property int theta: 45 // Degrees: 0= new moon, 90= first quarter, 180= full moon, 270= third quarter property int theta: 45 // Degrees: 0= new moon, 90= first quarter, 180= full moon, 270= third quarter
property alias radius: lunaBackground.radius
Item { Item {
id: lunaBackground id: lunaBackground
property int radius: Math.floor(height / 2)
anchors.centerIn: parent anchors.centerIn: parent
width: Math.min(parent.width, parent.height) width: Math.min(parent.width, parent.height)
height: Math.min(parent.width, parent.height) height: Math.min(parent.width, parent.height)
...@@ -92,8 +95,6 @@ Item { ...@@ -92,8 +95,6 @@ Item {
strokeWidth: -1 //no stroke strokeWidth: -1 //no stroke
PathAngleArc { PathAngleArc {
property int radius: Math.floor(height / 2)
centerX: radius centerX: radius
centerY: radius centerY: radius
radiusY: radius radiusY: radius
...@@ -121,10 +122,10 @@ Item { ...@@ -121,10 +122,10 @@ Item {
onLatitudeChanged: requestPaint() onLatitudeChanged: requestPaint()
onThetaChanged: requestPaint() onThetaChanged: requestPaint()
onShowShadowChanged: requestPaint() onShowShadowChanged: requestPaint()
onWidthChanged: requestPaint()
onPaint: { onPaint: {
context.reset(); context.reset();
if (showShadow) { if (showShadow) {
var radius = Math.floor(height / 2);
var cosTheta = Math.cos(theta / 180 * Math.PI); var cosTheta = Math.cos(theta / 180 * Math.PI);
var counterclockwisep = (theta < 180); var counterclockwisep = (theta < 180);
context.globalAlpha = 0.9; context.globalAlpha = 0.9;
...@@ -151,7 +152,6 @@ Item { ...@@ -151,7 +152,6 @@ Item {
id: markers id: markers
property int latitude: lunaIcon.latitude property int latitude: lunaIcon.latitude
property int theta: lunaIcon.theta
property bool showShadow: lunaIcon.showShadow property bool showShadow: lunaIcon.showShadow
property bool showGrid: lunaIcon.showGrid property bool showGrid: lunaIcon.showGrid
property bool showTycho: lunaIcon.showTycho property bool showTycho: lunaIcon.showTycho
...@@ -202,7 +202,6 @@ Item { ...@@ -202,7 +202,6 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
contextType: "2d" contextType: "2d"
onLatitudeChanged: requestPaint() onLatitudeChanged: requestPaint()
onThetaChanged: requestPaint()
onShowGridChanged: requestPaint() onShowGridChanged: requestPaint()
onShowTychoChanged: requestPaint() onShowTychoChanged: requestPaint()
onShowCopernicusChanged: requestPaint() onShowCopernicusChanged: requestPaint()
...@@ -210,7 +209,6 @@ Item { ...@@ -210,7 +209,6 @@ Item {
onPaint: { onPaint: {
context.reset(); context.reset();
if (!showShadow) { if (!showShadow) {
var radius = Math.floor(height / 2);
var cosTheta = Math.cos(theta / 180 * Math.PI); var cosTheta = Math.cos(theta / 180 * Math.PI);
var counterclockwisep = (theta < 180); var counterclockwisep = (theta < 180);
context.globalAlpha = 0.9; context.globalAlpha = 0.9;
...@@ -255,8 +253,6 @@ Item { ...@@ -255,8 +253,6 @@ Item {
strokeWidth: -1 //no stroke strokeWidth: -1 //no stroke
PathAngleArc { PathAngleArc {
property int radius: Math.floor(height / 2)
centerX: radius centerX: radius
centerY: radius centerY: radius
radiusY: radius radiusY: radius
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment