Use loops for toolbar items

This commit is contained in:
Jarrod Doyle 2024-04-14 13:14:32 +01:00
parent e7b316be1f
commit e5472b867c
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 28 additions and 78 deletions

View File

@ -29,98 +29,48 @@ export component ToolBar inherits VerticalBox {
out property <ToolType> p-current-tool: ToolType.Select; out property <ToolType> p-current-tool: ToolType.Select;
ToolBarItem { private property <[{text: string, type: ToolType}]> p-transform-tools: [
p-text: "s"; { text: "s", type: ToolType.Select },
a-clicked => { { text: "m", type: ToolType.Move },
p-current-tool = ToolType.Select; { text: "r", type: ToolType.Rotate },
} { text: "s", type: ToolType.Scale },
} ];
private property <[{text: string, type: ToolType}]> p-brush-tools: [
{ text: "b", type: ToolType.Brush },
{ text: "o", type: ToolType.Object },
{ text: "f", type: ToolType.Flow },
{ text: "r", type: ToolType.Room },
{ text: "l", type: ToolType.Light },
{ text: "a", type: ToolType.Area },
];
private property <[{text: string, type: ToolType}]> p-other-tools: [
{ text: "t", type: ToolType.Texture },
{ text: "t", type: ToolType.Timeline },
{ text: "m", type: ToolType.Multibrush },
];
ToolBarItem { for item[index] in root.p-transform-tools: ToolBarItem {
p-text: "m"; p-text: item.text;
a-clicked => { a-clicked => {
p-current-tool = ToolType.Move; root.p-current-tool = item.type;
}
}
ToolBarItem {
p-text: "r";
a-clicked => {
p-current-tool = ToolType.Rotate;
}
}
ToolBarItem {
p-text: "s";
a-clicked => {
p-current-tool = ToolType.Scale;
} }
} }
HorizontalSeparator { } HorizontalSeparator { }
ToolBarItem { for item[index] in root.p-brush-tools: ToolBarItem {
p-text: "b"; p-text: item.text;
a-clicked => { a-clicked => {
p-current-tool = ToolType.Brush; root.p-current-tool = item.type;
}
}
ToolBarItem {
p-text: "o";
a-clicked => {
p-current-tool = ToolType.Object;
}
}
ToolBarItem {
p-text: "f";
a-clicked => {
p-current-tool = ToolType.Flow;
}
}
ToolBarItem {
p-text: "r";
a-clicked => {
p-current-tool = ToolType.Room;
}
}
ToolBarItem {
p-text: "l";
a-clicked => {
p-current-tool = ToolType.Light;
}
}
ToolBarItem {
p-text: "a";
a-clicked => {
p-current-tool = ToolType.Area;
} }
} }
HorizontalSeparator { } HorizontalSeparator { }
ToolBarItem { for item[index] in root.p-other-tools: ToolBarItem {
p-text: "t"; p-text: item.text;
a-clicked => { a-clicked => {
p-current-tool = ToolType.Texture; root.p-current-tool = item.type;
}
}
ToolBarItem {
p-text: "t";
a-clicked => {
p-current-tool = ToolType.Timeline;
}
}
ToolBarItem {
p-text: "m";
a-clicked => {
p-current-tool = ToolType.Multibrush;
} }
} }
} }