Skip to content

Commit bc0aeb4

Browse files
committed
Reorder buttons to match default UI
1 parent 55daac1 commit bc0aeb4

1 file changed

Lines changed: 64 additions & 62 deletions

File tree

src/ui/mapWindow.ts

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -34,72 +34,72 @@ export default class MapWindow {
3434

3535
this.loadData();
3636

37-
const btnRotate: ButtonWidget = {
37+
const btnScaleDown: ButtonWidget = {
3838
type: "button",
3939
x: this.margin,
4040
y: this.margin + this.toolbarHeight,
4141
height: this.buttonSize,
4242
width: this.buttonSize,
43-
name: "rotate",
43+
name: "scaleDown",
4444
border: true,
45-
tooltip: "Rotate view",
46-
image: 5169, // SPR_ROTATE_ARROW
45+
tooltip: "Scale down",
46+
image: 29357 + 9, // SPR_G2_ZOOM_OUT
4747
onClick: (): void => {
48-
this.rotation = (this.rotation + 1) % 4;
48+
if (this.tileSize > 1) {
49+
this.tileSize = this.tileSize / 2;
50+
this.changeSize();
51+
}
4952
}
5053
};
5154

52-
const btnShowRides: ButtonWidget = {
55+
const btnScaleUp: ButtonWidget = {
5356
type: "button",
54-
x: this.margin * 2 + this.buttonSize,
57+
x: this.margin + this.buttonSize,
5558
y: this.margin + this.toolbarHeight,
5659
height: this.buttonSize,
5760
width: this.buttonSize,
58-
name: "showRides",
61+
name: "scaleUp",
5962
border: true,
60-
tooltip: "Toggle rides visible",
61-
isPressed: this.options.showRides,
62-
image: 5187, // SPR_RIDE
63+
tooltip: "Scale up",
64+
image: 29357 + 7, // SPR_G2_ZOOM_IN
6365
onClick: (): void => {
64-
this.options.showRides = !this.options.showRides;
65-
this.loadData();
66-
(window.widgets.filter(w => w.name == "showRides")[0] as ButtonWidget).isPressed = this.options.showRides;
66+
if (this.tileSize < 16) {
67+
this.tileSize = this.tileSize * 2;
68+
this.changeSize();
69+
}
6770
}
6871
};
6972

70-
const btnShowFootpath: ButtonWidget = {
73+
const btnRotate: ButtonWidget = {
7174
type: "button",
72-
x: this.margin * 2 + this.buttonSize * 2,
75+
x: this.margin + this.buttonSize * 2,
7376
y: this.margin + this.toolbarHeight,
7477
height: this.buttonSize,
7578
width: this.buttonSize,
76-
name: "showFootpath",
79+
name: "rotate",
7780
border: true,
78-
tooltip: "Toggle footpath visible",
79-
isPressed: this.options.showFootpath,
80-
image: 29357 + 15, // SPR_G2_BUTTON_FOOTPATH
81+
tooltip: "Rotate view",
82+
image: 5169, // SPR_ROTATE_ARROW
8183
onClick: (): void => {
82-
this.options.showFootpath = !this.options.showFootpath;
83-
this.loadData();
84-
(window.widgets.filter(w => w.name == "showFootpath")[0] as ButtonWidget).isPressed = this.options.showFootpath;
84+
this.rotation = (this.rotation + 1) % 4;
8585
}
8686
};
8787

88-
const btnShowScenery: ButtonWidget = {
88+
const btnShowSurface: ButtonWidget = {
8989
type: "button",
9090
x: this.margin * 2 + this.buttonSize * 3,
9191
y: this.margin + this.toolbarHeight,
9292
height: this.buttonSize,
9393
width: this.buttonSize,
94-
name: "showScenery",
94+
name: "showSurface",
9595
border: true,
96-
tooltip: "Toggle scenery visible",
97-
isPressed: this.options.showScenery,
98-
image: 5171, // SPR_SCENERY
96+
tooltip: "Toggle surface visible",
97+
isPressed: this.options.showSurface,
98+
image: 29357 + 5, // SPR_G2_TAB_LAND
9999
onClick: (): void => {
100-
this.options.showScenery = !this.options.showScenery;
100+
this.options.showSurface = !this.options.showSurface;
101101
this.loadData();
102-
(window.widgets.filter(w => w.name == "showScenery")[0] as ButtonWidget).isPressed = this.options.showScenery;
102+
(window.widgets.filter(w => w.name == "showSurface")[0] as ButtonWidget).isPressed = this.options.showSurface;
103103
}
104104
};
105105

@@ -121,57 +121,57 @@ export default class MapWindow {
121121
}
122122
};
123123

124-
const btnShowSurface: ButtonWidget = {
124+
const btnShowScenery: ButtonWidget = {
125125
type: "button",
126126
x: this.margin * 2 + this.buttonSize * 5,
127127
y: this.margin + this.toolbarHeight,
128128
height: this.buttonSize,
129129
width: this.buttonSize,
130-
name: "showSurface",
130+
name: "showScenery",
131131
border: true,
132-
tooltip: "Toggle surface visible",
133-
isPressed: this.options.showSurface,
134-
image: 29357 + 5, // SPR_G2_TAB_LAND
132+
tooltip: "Toggle scenery visible",
133+
isPressed: this.options.showScenery,
134+
image: 5171, // SPR_SCENERY
135135
onClick: (): void => {
136-
this.options.showSurface = !this.options.showSurface;
136+
this.options.showScenery = !this.options.showScenery;
137137
this.loadData();
138-
(window.widgets.filter(w => w.name == "showSurface")[0] as ButtonWidget).isPressed = this.options.showSurface;
138+
(window.widgets.filter(w => w.name == "showScenery")[0] as ButtonWidget).isPressed = this.options.showScenery;
139139
}
140140
};
141141

142-
const btnScaleDown: ButtonWidget = {
142+
const btnShowFootpath: ButtonWidget = {
143143
type: "button",
144-
x: this.margin * 3 + this.buttonSize * 6,
144+
x: this.margin * 2 + this.buttonSize * 6,
145145
y: this.margin + this.toolbarHeight,
146146
height: this.buttonSize,
147147
width: this.buttonSize,
148-
name: "scaleDown",
148+
name: "showFootpath",
149149
border: true,
150-
tooltip: "Scale down",
151-
image: 29357 + 9, // SPR_G2_ZOOM_OUT
150+
tooltip: "Toggle footpath visible",
151+
isPressed: this.options.showFootpath,
152+
image: 29357 + 15, // SPR_G2_BUTTON_FOOTPATH
152153
onClick: (): void => {
153-
if (this.tileSize > 1) {
154-
this.tileSize = this.tileSize / 2;
155-
this.changeSize();
156-
}
154+
this.options.showFootpath = !this.options.showFootpath;
155+
this.loadData();
156+
(window.widgets.filter(w => w.name == "showFootpath")[0] as ButtonWidget).isPressed = this.options.showFootpath;
157157
}
158158
};
159159

160-
const btnScaleUp: ButtonWidget = {
160+
const btnShowRides: ButtonWidget = {
161161
type: "button",
162-
x: this.margin * 3 + this.buttonSize * 7,
162+
x: this.margin * 2 + this.buttonSize * 7,
163163
y: this.margin + this.toolbarHeight,
164164
height: this.buttonSize,
165165
width: this.buttonSize,
166-
name: "scaleUp",
166+
name: "showRides",
167167
border: true,
168-
tooltip: "Scale up",
169-
image: 29357 + 7, // SPR_G2_ZOOM_IN
168+
tooltip: "Toggle rides visible",
169+
isPressed: this.options.showRides,
170+
image: 5187, // SPR_RIDE
170171
onClick: (): void => {
171-
if (this.tileSize < 16) {
172-
this.tileSize = this.tileSize * 2;
173-
this.changeSize();
174-
}
172+
this.options.showRides = !this.options.showRides;
173+
this.loadData();
174+
(window.widgets.filter(w => w.name == "showRides")[0] as ButtonWidget).isPressed = this.options.showRides;
175175
}
176176
};
177177

@@ -212,16 +212,18 @@ export default class MapWindow {
212212
maxHeight: 10000,
213213
maxWidth: 10000,
214214
minHeight: 0,
215-
minWidth: btnScaleUp.x + btnScaleUp.width + this.margin,
215+
minWidth: btnShowSurface.x + btnShowSurface.width + this.margin,
216216
widgets: [
217-
btnRotate,
218-
btnShowRides,
219-
btnShowFootpath,
220-
btnShowScenery,
221-
btnShowWater,
222-
btnShowSurface,
223217
btnScaleDown,
224218
btnScaleUp,
219+
btnRotate,
220+
221+
btnShowSurface,
222+
btnShowWater,
223+
btnShowScenery,
224+
btnShowFootpath,
225+
btnShowRides,
226+
225227
mapWidget
226228
],
227229
onUpdate: () => {

0 commit comments

Comments
 (0)