mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 21:48:34 +00:00
+ Decided not to support Bounds() on Text3D objects, since there's a lot of work needed before it will be viable.
This commit is contained in:
parent
96693e062b
commit
62a0a034a1
@ -20,12 +20,10 @@ namespace OSCADSharp.UnitTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Text_BoundsBasedOnFontSize()
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void Text_BoundsNotSupported()
|
||||
{
|
||||
var obj = new Text3D("BBBB", 16);
|
||||
|
||||
Assert.AreEqual(new Vector3(32, 8, 0.5), obj.Bounds().TopRight);
|
||||
Assert.AreEqual(new Vector3(-32, -8, -0.5), obj.Bounds().BottomLeft);
|
||||
var obj = new Text3D("BBBB", 16).Bounds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,18 +145,10 @@ namespace OSCADSharp.Solids
|
||||
|
||||
/// <summary>
|
||||
/// Returns the approximate boundaries of this OpenSCAD object
|
||||
///
|
||||
/// Disclaimer: The bounds for text are particularly inaccurate, since
|
||||
/// OSCADSharp doesn't have all font data necessary to calculate the
|
||||
/// boundaries for all the possible fonts that could be used
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Bounds Bounds()
|
||||
{
|
||||
double fontSize = this.Size ?? 8;
|
||||
double xAmount = fontSize * this.Text.Length;
|
||||
|
||||
return new Bounds(new Vector3(-xAmount/2, -fontSize/2, -.5), new Vector3(xAmount / 2, fontSize / 2, .5));
|
||||
throw new NotSupportedException("Bounds are not supported for objects using Text3D");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user