Skip to content

Commit

Permalink
Changing Uno to UWPUno, changing dependency properties to doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Jun 21, 2020
1 parent ca1dbdd commit 4a4a40d
Show file tree
Hide file tree
Showing 93 changed files with 186 additions and 3,821 deletions.
6 changes: 3 additions & 3 deletions CSharpMath.Rendering/FrontEnd/ICSharpMathAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public interface ICSharpMathAPI<TContent, TColor> where TContent : class {
TColor TextColor { get; set; }
TColor ErrorColor { get; set; }
///<summary>Unit of measure: points; Defaults to <see cref="FontSize"/>.</summary>
float? ErrorFontSize { get; set; }
double? ErrorFontSize { get; set; }
bool DisplayErrorInline { get; set; }
PaintStyle PaintStyle { get; set; }
float Magnification { get; set; }
double Magnification { get; set; }
string? ErrorMessage { get; }
#endregion Non-display-recreating properties
#region Display-recreating properties
/// <summary>Unit of measure: points</summary>
float FontSize { get; set; }
double FontSize { get; set; }
System.Collections.Generic.IEnumerable<Typeface> LocalTypefaces { get; set; }
Atom.LineStyle LineStyle { get; set; }
TContent? Content { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion CSharpMath.Rendering/FrontEnd/MathPainter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected override void UpdateDisplayCore(float unused) {
public override void Draw(TCanvas canvas, TextAlignment alignment = TextAlignment.Center, Thickness padding = default, float offsetX = 0, float offsetY = 0) {
var c = WrapCanvas(canvas);
UpdateDisplay(float.NaN);
DrawCore(c, Display, Display == null ? new PointF?() : IPainterExtensions.GetDisplayPosition(Display.Width, Display.Ascent, Display.Descent, FontSize, c.Width, c.Height, alignment, padding, offsetX, offsetY));
DrawCore(c, Display, Display == null ? new PointF?() : IPainterExtensions.GetDisplayPosition(Display.Width, Display.Ascent, Display.Descent, (float)FontSize, c.Width, c.Height, alignment, padding, offsetX, offsetY));
}
public void Draw(TCanvas canvas, float x, float y) {
var c = WrapCanvas(canvas);
Expand Down
12 changes: 6 additions & 6 deletions CSharpMath.Rendering/FrontEnd/Painter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public Painter() {
/// Unit of measure: points;
/// Defaults to <see cref="FontSize"/>.
/// </summary>
public float? ErrorFontSize { get; set; }
public double? ErrorFontSize { get; set; }
public bool DisplayErrorInline { get; set; } = true;
public TColor ErrorColor { get; set; }
public TColor TextColor { get; set; }
public TColor HighlightColor { get; set; }
public (TColor glyph, TColor textRun)? GlyphBoxColor { get; set; }
public PaintStyle PaintStyle { get; set; } = PaintStyle.Fill;
public float Magnification { get; set; } = 1;
public double Magnification { get; set; } = 1;
public string? ErrorMessage { get; protected set; }
public abstract IDisplay<Fonts, Glyph>? Display { get; protected set; }
#endregion Non-redisplaying properties
Expand All @@ -47,9 +47,9 @@ public Painter() {
protected abstract void SetRedisplay();
protected Fonts Fonts { get; private set; } = new Fonts(Array.Empty<Typeface>(), DefaultFontSize);
/// <summary>Unit of measure: points</summary>
public float FontSize { get => Fonts.PointSize; set { Fonts = new Fonts(Fonts, value); SetRedisplay(); } }
public double FontSize { get => Fonts.PointSize; set { Fonts = new Fonts(Fonts, (float)value); SetRedisplay(); } }
IEnumerable<Typeface> __localTypefaces = Array.Empty<Typeface>();
public IEnumerable<Typeface> LocalTypefaces { get => __localTypefaces; set { Fonts = new Fonts(value, FontSize); __localTypefaces = value; SetRedisplay(); } }
public IEnumerable<Typeface> LocalTypefaces { get => __localTypefaces; set { Fonts = new Fonts(value, (float)FontSize); __localTypefaces = value; SetRedisplay(); } }
Atom.LineStyle __style = Atom.LineStyle.Display;
public Atom.LineStyle LineStyle { get => __style; set { __style = value; SetRedisplay(); } }
TContent? __content;
Expand All @@ -74,7 +74,7 @@ protected void UpdateDisplay(float textPainterCanvasWidth) {
UpdateDisplayCore(textPainterCanvasWidth);
if (Display == null && DisplayErrorInline && ErrorMessage != null) {
var font = Fonts;
if (ErrorFontSize is { } errorSize) font = new Fonts(font, errorSize);
if (ErrorFontSize is { } errorSize) font = new Fonts(font, (float)errorSize);
var errorLines = ErrorMessage.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
var runs = new List<Display.Displays.TextRunDisplay<Fonts, Glyph>>();
float y = 0;
Expand Down Expand Up @@ -116,7 +116,7 @@ protected void DrawCore(ICanvas canvas, IDisplay<Fonts, Glyph>? display, PointF?
canvas.Save();
//invert the canvas vertically: displays are drawn with mathematical coordinates, not graphical coordinates
canvas.Scale(1, -1);
canvas.Scale(Magnification, Magnification);
canvas.Scale((float)Magnification, (float)Magnification);
if (position is { } p) display.Position = new PointF(p.X, p.Y);
canvas.DefaultColor = WrapColor(TextColor);
canvas.CurrentColor = WrapColor(HighlightColor);
Expand Down
2 changes: 1 addition & 1 deletion CSharpMath.Rendering/FrontEnd/TextPainter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void DrawCore(TCanvas canvas, float? width, TextAlignment alignment,
System.Math.Max(_relativeXCoordDisplay.Width, _absoluteXCoordDisplay.Width),
System.Math.Max(_relativeXCoordDisplay.Ascent, _absoluteXCoordDisplay.Ascent),
System.Math.Max(_relativeXCoordDisplay.Descent, _absoluteXCoordDisplay.Descent),
FontSize, width ?? c.Width,
(float)FontSize, width ?? c.Width,
c.Height, alignment, padding, offsetX, offsetY
));
var adjustedCanvasWidth =
Expand Down
22 changes: 0 additions & 22 deletions CSharpMath.SkiaSharp.Wasm/CSharpMath.SkiaSharp.Wasm.csproj

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

43 changes: 0 additions & 43 deletions CSharpMath.Uno.Example/CSharpMath.Uno.Example.Droid/Main.cs

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Loading

0 comments on commit 4a4a40d

Please sign in to comment.