1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Mark pinned shapes in statistics dialog

This commit is contained in:
tobspr
2020-08-28 21:17:07 +02:00
parent e6b5f8d2ed
commit 8ba6517591
4 changed files with 531 additions and 501 deletions

View File

@@ -87,7 +87,7 @@ export class HUDStatistics extends BaseHUDPart {
*/
setSorted(sorted) {
this.sorted = sorted;
this.dialogInner.setAttribute("data-sorted", sorted);
this.dialogInner.setAttribute("data-sorted", String(sorted));
if (this.visible) {
this.rerenderFull();
}
@@ -201,7 +201,16 @@ export class HUDStatistics extends BaseHUDPart {
}
}
const pinnedShapes = this.root.hud.parts.pinnedShapes;
entries.sort((a, b) => {
const aPinned = pinnedShapes.isShapePinned(a[0]);
const bPinned = pinnedShapes.isShapePinned(b[0]);
if (aPinned !== bPinned) {
return aPinned ? -1 : 1;
}
// Sort by shape key for some consistency
if (!this.sorted || b[1] == a[1]) {
return b[0].localeCompare(a[0]);

View File

@@ -74,6 +74,11 @@ export class HUDShapeStatisticsHandle {
return;
}
this.element.classList.toggle(
"pinned",
this.root.hud.parts.pinnedShapes.isShapePinned(this.definition.getHash())
);
switch (dataSource) {
case enumAnalyticsDataSource.stored: {
this.counter.innerText = formatBigNumber(