Skip to content

Commit d9323bf

Browse files
committed
Updated StashListItem
1 parent d9f658b commit d9323bf

File tree

8 files changed

+56
-133
lines changed

8 files changed

+56
-133
lines changed

Packages/com.quickeye.http-debugger/Editor/Elements/EditableLabel.cs

Lines changed: 0 additions & 73 deletions
This file was deleted.

Packages/com.quickeye.http-debugger/Editor/Elements/EditableLabel.cs.meta

Lines changed: 0 additions & 3 deletions
This file was deleted.

Packages/com.quickeye.http-debugger/Editor/Elements/RequestButtonBig.cs renamed to Packages/com.quickeye.http-debugger/Editor/Elements/StashListItem.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@
88

99
namespace QuickEye.WebTools.Editor
1010
{
11-
public class RequestButtonBig : VisualElement
11+
public class StashListItem : VisualElement
1212
{
1313
public Action Deleted;
1414
public Action Duplicated;
1515

1616
private readonly Label _typeLabel;
17-
private readonly EditableLabel _nameLabel;
18-
private readonly Button _dropdownButton;
17+
private readonly Label _nameLabel;
18+
private readonly Label _dropdownButton;
1919

20-
public RequestButtonBig()
20+
public StashListItem()
2121
{
2222
this.InitResources();
23-
Add(_typeLabel = new Label().Class("rbb-type"));
24-
Add(_nameLabel = new EditableLabel().Class("rbb-name"));
25-
Add(_dropdownButton = new Button() { text = "▼" }.Clicked(() =>
23+
AddToClassList("stash-list-item");
24+
Add(_typeLabel = new Label().Class("stash-list-item__type-label"));
25+
Add(_nameLabel = new Label().Class("stash-list-item__name-label"));
26+
Add(_dropdownButton = new Label("▼").Class("stash-list-item__dropdown").Clicked(() =>
2627
{
2728
var menu = new GenericMenu();
2829
menu.AddItem(new GUIContent("Duplicate"), false, () => Duplicated?.Invoke());
@@ -47,7 +48,7 @@ public void BindProperties(SerializedProperty typeProp, SerializedProperty nameP
4748

4849
private static string EnumIndexToDisplayText(int i) => ((HttpMethodType)i).ToString()[..3].ToUpperInvariant();
4950

50-
public new class UxmlFactory : UxmlFactory<RequestButtonBig, UxmlTraits> { }
51+
public new class UxmlFactory : UxmlFactory<StashListItem, UxmlTraits> { }
5152

5253
public new class UxmlTraits : VisualElement.UxmlTraits
5354
{
@@ -65,8 +66,8 @@ public override IEnumerable<UxmlChildElementDescription> uxmlChildElementsDescri
6566
public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
6667
{
6768
base.Init(ve, bag, cc);
68-
ve.As<RequestButtonBig>()._nameLabel.value = _text.GetValueFromBag(bag, cc);
69-
ve.As<RequestButtonBig>()._typeLabel.text = _type.GetValueFromBag(bag, cc).ToString();
69+
ve.As<StashListItem>()._nameLabel.text = _text.GetValueFromBag(bag, cc);
70+
ve.As<StashListItem>()._typeLabel.text = _type.GetValueFromBag(bag, cc).ToString();
7071
}
7172
}
7273
}

Packages/com.quickeye.http-debugger/Editor/Elements/RequestButtonBig.cs.meta renamed to Packages/com.quickeye.http-debugger/Editor/Elements/StashListItem.cs.meta

File renamed without changes.

Packages/com.quickeye.http-debugger/Editor/Resources/QuickEye/HttpDebugger/RequestButtonBig-dark.style.uss renamed to Packages/com.quickeye.http-debugger/Editor/Resources/QuickEye/HttpDebugger/StashListItem.style.uss

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,39 @@
1-
RequestButtonBig {
2-
height: 36px;
3-
flex-direction: row;
4-
align-items: center;
5-
padding-left: 11px;
6-
}
7-
8-
RequestButtonBig > * {
9-
font-size: 15px;
10-
}
11-
12-
.rbb-type {
13-
-unity-font-style: bold;
14-
width: 42px;
15-
}
16-
17-
RequestButtonBig > Button {
18-
-unity-font-style: bold;
19-
background-color: rgba(108, 108, 108, 0);
20-
margin-left: 4px;
21-
margin-right: 4px;
22-
margin-top: 4px;
23-
margin-bottom: 4px;
24-
padding-left: 0;
25-
padding-right: 0;
26-
padding-top: 0;
27-
padding-bottom: 0;
28-
width: 17px;
29-
border-left-color: rgba(0, 0, 0, 0);
30-
border-right-color: rgba(0, 0, 0, 0);
31-
border-top-color: rgba(0, 0, 0, 0);
32-
border-bottom-color: rgba(0, 0, 0, 0);
33-
font-size: 11px;
34-
}
35-
36-
.rbb-name {
37-
flex-shrink: 1;
38-
}
39-
40-
RequestButtonBig > Button:hover {
41-
color: rgba(255, 255, 255, 0.58);
42-
}
1+
.stash-list-item {
2+
height: 36px;
3+
flex-direction: row;
4+
align-items: center;
5+
padding-left: 11px;
6+
}
7+
8+
.stash-list-item > * {
9+
font-size: 15px;
10+
}
11+
12+
.stash-list-item__type-label {
13+
-unity-font-style: bold;
14+
width: 42px;
15+
}
16+
17+
.stash-list-item__name-label {
18+
flex-shrink: 1;
19+
overflow: hidden;
20+
flex-grow: 1;
21+
}
22+
23+
.stash-list-item__dropdown {
24+
-unity-font-style: bold;
25+
margin-left: 4px;
26+
margin-right: 4px;
27+
margin-top: 4px;
28+
margin-bottom: 4px;
29+
padding-left: 0;
30+
padding-right: 0;
31+
padding-top: 0;
32+
padding-bottom: 0;
33+
width: 17px;
34+
font-size: 11px;
35+
}
36+
37+
.stash-list-item__dropdown:hover {
38+
color: rgba(255, 255, 255, 0.58);
39+
}

Packages/com.quickeye.http-debugger/Editor/Resources/QuickEye/HttpDebugger/RequestButtonBig-dark.style.uss.meta renamed to Packages/com.quickeye.http-debugger/Editor/Resources/QuickEye/HttpDebugger/StashListItem.style.uss.meta

File renamed without changes.

Packages/com.quickeye.http-debugger/Editor/UIAssets/RequestStash.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,20 @@ where name.ToLower().Contains(evt.newValue.ToLower())
8585

8686
private void InitList()
8787
{
88-
stashList.makeItem = () => new RequestButtonBig();
88+
stashList.makeItem = () => new StashListItem();
8989
stashList.bindItem = (ve, index) =>
9090
{
9191
var serObj = new SerializedObject(Source[index]);
9292
var typeProp = serObj.FindProperty(nameof(RequestData.type));
9393
var nameProp = serObj.FindProperty(RequestData.NamePropertyName);
94-
var button = ve.As<RequestButtonBig>();
95-
button.BindProperties(typeProp, nameProp);
96-
button.Deleted = () =>
94+
var listItem = ve.As<StashListItem>();
95+
listItem.BindProperties(typeProp, nameProp);
96+
listItem.Deleted = () =>
9797
{
9898
_requestList.RemoveAt(index);
9999
stashList.Rebuild();
100100
};
101-
button.Duplicated = () =>
101+
listItem.Duplicated = () =>
102102
{
103103
_requestList.Insert(index, RequestData.Create(Source[index]));
104104
stashList.Rebuild();

Packages/com.quickeye.http-debugger/Editor/UIAssets/RequestStash.uxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
2+
<Style src="project://database/Packages/com.quickeye.http-debugger/Editor/Resources/QuickEye/HttpDebugger/StashListItem.style.uss?fileID=7433441132597879392&amp;guid=90457ee4361b42fa995aeae37ca28bb7&amp;type=3#StashListItem.style" />
23
<uie:Toolbar class="header-toolbar">
34
<uie:ToolbarButton name="create--button" text="+" class="header-toolbar--button" style="width: 28px; -unity-font-style: bold; -unity-text-align: middle-center; font-size: 20px; padding-left: 0; padding-right: 0; padding-top: 0; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; padding-bottom: 3px;" />
45
<uie:ToolbarSearchField focusable="true" name="search-field" style="flex-shrink: 1; flex-grow: 1;" />

0 commit comments

Comments
 (0)