Skip to content

Commit

Permalink
Changes for 1.0.6
Browse files Browse the repository at this point in the history
Added tracker manually to avoid submodule conflicts for now
Reduced ui size
Added resize option
  • Loading branch information
Victorma committed Jan 22, 2020
1 parent 11bd68c commit 32adddc
Show file tree
Hide file tree
Showing 74 changed files with 10,772 additions and 40 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

32 changes: 26 additions & 6 deletions Assets/uAdventure/Editor/PreviewLayoutWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ protected PreviewLayoutWindow(Rect rect, GUIContent content, GUIStyle style, par
PreviewTitle = "ImageAssets.Preview".Traslate();
Margin = 30;
LeaveWindowSpace = true;
if (previewResizer == null)
{
previewResizer = new PreviewResizer();
previewResizer.Init("Preview");
}
}

/** Callback for window destroy */
Expand All @@ -45,6 +50,10 @@ protected void OnDestroy()
private Vector2 scroll;
private bool useScroll = false;

private static PreviewResizer previewResizer;
private static float previewHeight;
private Vector2 topScroll;

// ######################## PROPERTIES ###########################

/** Position of the preview inspector window */
Expand Down Expand Up @@ -123,14 +132,18 @@ protected virtual void ApplicationUpdate()
/** Called to draw the main Extension window content */
public override void Draw(int aID)
{
topScroll = EditorGUILayout.BeginScrollView(topScroll, GUILayout.Height(m_Rect.height - previewHeight - 25));
DrawInspector();
EditorGUILayout.EndScrollView();

DrawPreviewHeader();
var auxRect = EditorGUILayout.BeginVertical("preBackground", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

GUILayout.Box("", "preBackground", GUILayout.ExpandWidth(true), GUILayout.Height(previewHeight - 35));
{

var auxRect = GUILayoutUtility.GetLastRect();
if (Event.current.type == EventType.Repaint)
{
//auxRect.height = previewHeight;
areaRect = auxRect;

auxRect.position = Vector2.zero;
Expand Down Expand Up @@ -163,7 +176,7 @@ public override void Draw(int aID)
case Corner.BottomLeft:
case Corner.TopLeft:
{
var reduction = (windowRect.width + 10) * Mathf.Clamp01(1f - (Vector2.Distance(windowRect.position, corner.Value) / (previewRect.width / 3f)));
var reduction = (windowRect.width + 10) * Mathf.Clamp01(1f - (Vector2.Distance(windowRect.position, corner.Value) / (previewRect.width / 4f)));

viewport.x += reduction;
viewport.width -= reduction;
Expand All @@ -173,7 +186,7 @@ public override void Draw(int aID)
case Corner.BottomRight:
case Corner.TopRight:
{
var reduction = (windowRect.width + 10) * Mathf.Clamp01(1f - (Vector2.Distance(windowRect.position, corner.Value) / (previewRect.width / 3f)));
var reduction = (windowRect.width + 10) * Mathf.Clamp01(1f - (Vector2.Distance(windowRect.position, corner.Value) / (previewRect.width / 4f)));
viewport.width -= reduction;
}
break;
Expand Down Expand Up @@ -244,7 +257,6 @@ public override void Draw(int aID)
GUILayout.EndArea();
}

EditorGUILayout.EndVertical();

}

Expand All @@ -254,8 +266,16 @@ protected virtual void DrawInspector() { }
/** Called to draw the preview header */
protected virtual void DrawPreviewHeader()
{
GUILayout.Space(10);
GUILayout.Label(PreviewTitle, "preToolbar", GUILayout.ExpandWidth(true));
var lastRect = GUILayoutUtility.GetLastRect();
var window = m_Rect;
window.height += 35;

previewHeight = previewResizer.ResizeHandle(window, 50, 50, 20, lastRect);
if (!previewResizer.GetExpanded())
{
previewResizer.ToggleExpanded();
}
}

/** Called to draw the preview content */
Expand Down
Loading

0 comments on commit 32adddc

Please sign in to comment.