Skip to content

Commit 41da516

Browse files
tweak layer menu
1 parent 47212ba commit 41da516

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

ASECII/LayerMenu.cs

+10-13
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public LayerMenu(int width, int height, SpriteModel model) : base(width, height)
1717
public void UpdateListing() {
1818
this.Children.Clear();
1919
var layers = model.sprite.layers;
20-
int i = layers.Count - 1;
21-
foreach (var l in ((IEnumerable<Layer>)layers).Reverse()) {
20+
int i = 0;
21+
foreach(var l in layers) {
2222
int index = i;
2323
int x = 0;
24-
int y = i;
24+
int y = layers.Count - i - 1;
2525
this.Children.Add(new ColorCellButton(() => l.visible ? Color.White : Color.Black,
2626
() => {
2727
l.visible = !l.visible;
@@ -60,7 +60,9 @@ public void UpdateListing() {
6060

6161
string GetLabel() => $">{(l.name.Length > 8 ? l.name.Remove(8) : l.name)}";
6262

63-
var layerSettings = new LayerSettings(l, () => nameButton.text = GetLabel()) { Position = new Point(16, index) };
63+
var layerSettings = new LayerSettings(l, () => nameButton.text = GetLabel()){
64+
Position = new Point(16, index)
65+
};
6466

6567
this.Children.Add(new ColorCellButton(() => !this.Children.Contains(layerSettings) ? Color.White : Color.Black,
6668
() => {
@@ -76,39 +78,34 @@ public void UpdateListing() {
7678

7779
nameButton = new ColorButton(GetLabel(),
7880
() => model.currentLayerIndex == index ? Color.Yellow : Color.White,
79-
() => model.currentLayerIndex = index) {
80-
Position = new Point(4, y)
81-
};
81+
() => model.currentLayerIndex = index
82+
) { Position = new Point(4, y) };
8283
this.Children.Add(nameButton);
8384

8485
this.Children.Add(new CellButton(() => index > 0,
8586
() => {
87+
//Change to use Edits
8688
var below = layers[index - 1];
8789
below.Flatten(l);
8890
layers.RemoveAt(index);
89-
9091
if (model.currentLayerIndex == index) {
9192
model.currentLayerIndex--;
9293
}
93-
9494
UpdateListing();
9595
}, '%') {
9696
Position = new Point(13, y)
9797
});
98-
9998
this.Children.Add(new CellButton(() => model.sprite.layers.Count > 1,
10099
() => {
101100
layers.RemoveAt(index);
102-
103101
if (model.currentLayerIndex == index && index > 0) {
104102
model.currentLayerIndex--;
105103
}
106-
107104
UpdateListing();
108105
}, 'X') {
109106
Position = new Point(15, y)
110107
});
111-
i--;
108+
i++;
112109
}
113110
}
114111
public override bool ProcessMouse(MouseScreenObjectState state) {

0 commit comments

Comments
 (0)