Size mesh to TextPrinter bounds on minimum or 8x8

- Issue MatterHackers/MCCentral#4933
Hit target for TextPathObject3D should be printer bounding box size
This commit is contained in:
John Lewin 2019-01-26 18:46:28 -08:00
parent 13d5e6f7f9
commit 7f7408d3c9

View file

@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using MatterHackers.Agg;
@ -154,8 +155,13 @@ namespace MatterHackers.MatterControl.DesignTools
{
using (this.RebuildLock())
{
// TODO: Revise fallback mesh
base.Mesh = this.InitMesh() ?? PlatonicSolids.CreateCube(100, 100, 0.2);
var bounds = this.VertexSource.GetBounds();
var center = bounds.Center;
var mesh = PlatonicSolids.CreateCube(Math.Max(8, bounds.Width), Math.Max(8, bounds.Height), 0.2);
mesh.Translate(new Vector3(center.X, center.Y, 0));
base.Mesh = mesh;
}
}