Skip to content

Commit 2447583

Browse files
authored
Fix maximize handler affecting only last status header column (#5796)
* Fix maximize handler affecting only last status header column * Apply Prettier formatting * Scope header query to status widget container
1 parent c766294 commit 2447583

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

js/widgets/status.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,29 @@ class StatusMatrix {
9494
>  `;
9595
}
9696
cell.style.width = "212.5px";
97-
this.widgetWindow.onmaximize = () => {
98-
this.isMaximized = !this.isMaximized;
99-
cell.style.width = "100vw";
100-
cell.style.paddingLeft = "30px";
101-
cell.style.fontSize =
102-
Math.floor(this._cellScale * StatusMatrix.FONTSCALEFACTOR) * 0.9 + "%";
103-
if (!this.isMaximized) {
104-
cell.style.width = "212.5px";
105-
}
106-
};
10797
// cell.style.width = StatusMatrix.BUTTONSIZE * this._cellScale*2 + "px";
10898
cell.style.height = Math.floor(MATRIXSOLFEHEIGHT * this._cellScale) + "px";
10999
cell.className = "headcol";
110100
}
111101

102+
this.widgetWindow.onmaximize = () => {
103+
this.isMaximized = !this.isMaximized;
104+
const headerFontSize =
105+
Math.floor(this._cellScale * StatusMatrix.FONTSCALEFACTOR) * 0.9 + "%";
106+
const headerCells = this._statusTable.querySelectorAll("thead .headcol");
107+
headerCells.forEach(headerCell => {
108+
if (this.isMaximized) {
109+
headerCell.style.width = "100vw";
110+
headerCell.style.paddingLeft = "30px";
111+
headerCell.style.fontSize = headerFontSize;
112+
} else {
113+
headerCell.style.width = "212.5px";
114+
headerCell.style.paddingLeft = "";
115+
headerCell.style.fontSize = "";
116+
}
117+
});
118+
};
119+
112120
// console.debug("active turtles: " + turtles.turtleList.length);
113121

114122
// One row per field, one column per mouse (plus the labels)
@@ -145,17 +153,18 @@ class StatusMatrix {
145153
if (localStorage.languagePreference === "ja") {
146154
label = _("beats per minute2");
147155
} else {
148-
label = this.activity.blocks.blockList[statusField[0]].protoblock
149-
.staticLabels[0];
156+
label =
157+
this.activity.blocks.blockList[statusField[0]].protoblock
158+
.staticLabels[0];
150159
}
151160
// console.debug(label);
152161
break;
153162
case "outputtools":
154163
label = this.activity.blocks.blockList[statusField[0]].privateData;
155164
break;
156165
default:
157-
label = this.activity.blocks.blockList[statusField[0]].protoblock
158-
.staticLabels[0];
166+
label =
167+
this.activity.blocks.blockList[statusField[0]].protoblock.staticLabels[0];
159168
break;
160169
}
161170
let str = label;

0 commit comments

Comments
 (0)