Visu fraction + placement

master
cldupland 5 years ago
parent 2f26718dac
commit f0c5aed372

@ -35,6 +35,8 @@ namespace TheGameExtreme.view
this.width = width;
height = (0.2f * (float)DeviceDisplay.MainDisplayInfo.Height - textPaint.TextSize) * 0.5f;
display = Value.ToString();
if (Value.View.GetType() == typeof(FractionCard))
{
textPaint1 = new SKPaint();
@ -42,9 +44,8 @@ namespace TheGameExtreme.view
textPaint1.TextSize = textPaint.TextSize;
textPaint2.TextSize = textPaint.TextSize;
}
display = Value.ToString();
//else
//{
if (!display.Contains(",") && !display.Contains(".") && !display.Contains("/"))
{
if (Value.Value.CompareTo(-10m) <= 0)
@ -56,7 +57,7 @@ namespace TheGameExtreme.view
this.width += textPaint.MeasureText("0") * 0.5f;
}
}
//}
Matrix = SKMatrix.MakeIdentity();
@ -107,23 +108,9 @@ namespace TheGameExtreme.view
if (Value.View.GetType() == typeof(FractionCard))
{
canvas.DrawRect(card, textPaint1);
if (((FractionCard)Value.View).Fraction.Numerateur < 10 && ((FractionCard)Value.View).Fraction.Numerateur > 0)
{
canvas.DrawText(((FractionCard)Value.View).Fraction.Numerateur.ToString(), width * 0.5f - textPaint.MeasureText(((FractionCard)Value.View).Fraction.Numerateur.ToString()) * 0.5f, - textPaint.TextSize * 0.5f - height * 0.5f, textPaint);
}
else
{
canvas.DrawText(((FractionCard)Value.View).Fraction.Numerateur.ToString(), width * 0.5f - textPaint.MeasureText(((FractionCard)Value.View).Fraction.Numerateur.ToString()) * 0.5f, - textPaint.TextSize * 0.5f - height * 0.5f, textPaint);
}
canvas.DrawText("__", textPaint.MeasureText("__") * 0.1f, -textPaint.TextSize * 0.6f, textPaint1);
if (((FractionCard)Value.View).Fraction.Denominateur < 10 && ((FractionCard)Value.View).Fraction.Denominateur > 0)
{
canvas.DrawText(((FractionCard)Value.View).Fraction.Denominateur.ToString(), width * 0.5f - textPaint.MeasureText(((FractionCard)Value.View).Fraction.Denominateur.ToString()) * 0.5f, height * 0.5f, textPaint2);
}
else
{
canvas.DrawText(((FractionCard)Value.View).Fraction.Denominateur.ToString(), width * 0.5f - textPaint.MeasureText(((FractionCard)Value.View).Fraction.Numerateur.ToString()) * 0.5f, 50, textPaint2);
}
canvas.DrawText("___", width * 0.5f - textPaint1.MeasureText("___") * 0.5f, -textPaint1.TextSize * 0.6f, textPaint1);
canvas.DrawText(((FractionCard)Value.View).Fraction.Denominateur.ToString(), width * 0.5f - textPaint2.MeasureText(((FractionCard)Value.View).Fraction.Numerateur.ToString()) * 0.5f, height * 0.5f, textPaint2);
}
else
{

Loading…
Cancel
Save