Exhibit Title textbox scaling now is limited to not exceed the tracker size horizontally
Removed old unneeded layouting properties for titles as the title layouting is now mostly computed dynamically
This commit is contained in:
2019-01-11 23:14:11 +01:00
parent 8f6b7ed2b3
commit 725cfdbffb
6 changed files with 11 additions and 33 deletions

View File

@@ -479,7 +479,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 0.5
m_MinWidth: 0.85
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
@@ -546,7 +546,7 @@ MonoBehaviour:
m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_HorizontalFit: 1
m_VerticalFit: 2
--- !u!222 &222375422432509192
CanvasRenderer:

View File

@@ -79,10 +79,6 @@ namespace RothenburgAR
Assert.NotNull(testExhibit.Description);
Assert.IsTrue(testExhibit.Title.HasValue);
Assert.AreEqual(40f, testExhibit.Title.Value.FontSize);
Assert.AreEqual(45f, testExhibit.Title.Value.BoxHeight);
Assert.AreEqual(200f, testExhibit.Title.Value.BoxWidth);
}
}
}

View File

@@ -40,13 +40,16 @@ namespace RothenburgAR.Exhibition
TitleBehaviour.Exhibit = this;
}
//TODO remove title rotation
if (newTitle.Rotation.HasValue)
TitleBehaviour.transform.localEulerAngles = newTitle.Rotation.Value + new Vector3(90, 0, 0);
TitleBehaviour.transform.localEulerAngles = new Vector3(90, 0, 0);
//TODO remove title position and calculate on the fly? if tracker is on a wall, below is best. if it sits on the ground, what?
//TODO remove title position property and calculate on the fly?
// if tracker is on a wall, below is best. if it sits on the ground, what?
// leave property alive for now and set title slightly below the bottom border for now
if (newTitle.Position.HasValue)
TitleBehaviour.transform.localPosition = newTitle.Position.Value;
else
TitleBehaviour.transform.localPosition = new Vector3(0, .05f, -.52f);
TitleBehaviour.DataText = newTitle.Text;
}

View File

@@ -88,21 +88,9 @@ namespace RothenburgAR.Exhibition
}
newExhibit.Description = exhibitDescr;
//TODO calculate sizes dynamically and remove these default values
var position = new Vector3(0, .1f, -.52f);
var rotation = Vector3.zero;
var fontSize = .7f;
var boxHeight = .25f;
var boxWidth = .75f;
PreloadedExhibitTitle preTitle = new PreloadedExhibitTitle
{
Text = exhibitTitle,
Position = position,
Rotation = rotation,
FontSize = fontSize,
BoxWidth = boxWidth,
BoxHeight = boxHeight
Text = exhibitTitle
};
newExhibit.Title = preTitle;

View File

@@ -93,11 +93,7 @@ namespace RothenburgAR.Exhibition
PreloadedExhibitTitle preTitle = new PreloadedExhibitTitle
{
Text = exhibitTitle,
Position = GetVector3FromXmlNode(exhibitNode.SelectSingleNode("title/position")),
Rotation = GetVector3FromXmlNode(exhibitNode.SelectSingleNode("title/rotation")),
FontSize = fontSize ?? 20,
BoxWidth = boxWidth ?? 200,
BoxHeight = boxHeight ?? 25
Position = GetVector3FromXmlNode(exhibitNode.SelectSingleNode("title/position"))
};
newExhibit.Title = preTitle;
}

View File

@@ -31,11 +31,6 @@ namespace RothenburgAR.Exhibition
public struct PreloadedExhibitTitle
{
public TextElement Text { get; set; }
public Vector3? Rotation { get; set; }
public Vector3? Position { get; set; }
public Vector2? Dimensions { get; set; }
public float FontSize { get; set; }
public float BoxHeight { get; set; }
public float BoxWidth { get; set; }
}
}