Browse Source

View preview boxes are now always displayed.

master
chrisgregan 11 years ago
parent
commit
fcab6a1d81
  1. 11
      Assets/Fungus/Editor/PageEditor.cs
  2. 14
      Assets/Fungus/Editor/ViewEditor.cs

11
Assets/Fungus/Editor/PageEditor.cs

@ -13,17 +13,6 @@ namespace Fungus
{
Page t = target as Page;
// Render the parent view to help user position the page
Transform parent = t.transform.parent;
if (parent != null)
{
View view = parent.gameObject.GetComponent<View>();
if (view != null)
{
ViewEditor.DrawView(view);
}
}
if (t.enabled)
{
EditPageBounds();

14
Assets/Fungus/Editor/ViewEditor.cs

@ -8,6 +8,16 @@ using Fungus;
[CustomEditor (typeof(View))]
public class ViewEditor : Editor
{
[DrawGizmo(GizmoType.NotSelected)]
static void RenderCustomGizmo(Transform objectTransform, GizmoType gizmoType)
{
View view = objectTransform.gameObject.GetComponent<View>();
if (view != null)
{
DrawView(view);
}
}
void OnSceneGUI ()
{
View t = target as View;
@ -39,6 +49,8 @@ public class ViewEditor : Editor
handles[0] = pos + new Vector3(0, -viewSize, 0);
handles[1] = pos + new Vector3(0, viewSize, 0);
Handles.color = t.primaryColor;
for (int i = 0; i < 2; ++i)
{
Vector3 newPos = Handles.FreeMoveHandle(handles[i],
@ -72,7 +84,7 @@ public class ViewEditor : Editor
verts[1] = pos + new Vector3(-widthB, height, 0);
verts[2] = pos + new Vector3(-widthA, height, 0);
verts[3] = pos + new Vector3(-widthA, -height, 0);
Handles.DrawSolidRectangleWithOutline(verts, view.secondaryColor, view.primaryColor );
}

Loading…
Cancel
Save