diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-06-02 19:43:45 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-06-02 19:43:45 +0800 |
commit | 9d1a7e4ebc4428be0e086dd4d75646294ba51f53 (patch) | |
tree | 11e8dec92d7c3bdf52faf29a890022e4dcd39a8d /features/statHistoryGui | |
parent | 7940745eb519224a6826f2b94ab7802cf05d94b8 (diff) | |
download | SoopyV2-9d1a7e4ebc4428be0e086dd4d75646294ba51f53.tar.gz SoopyV2-9d1a7e4ebc4428be0e086dd4d75646294ba51f53.tar.bz2 SoopyV2-9d1a7e4ebc4428be0e086dd4d75646294ba51f53.zip |
+make stat history gui main page less cluttered and sidebar for more graphs
+ fix streamsgui preview images being stretched sometimes
Diffstat (limited to 'features/statHistoryGui')
-rw-r--r-- | features/statHistoryGui/index.js | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/features/statHistoryGui/index.js b/features/statHistoryGui/index.js index 173137f..bd9998b 100644 --- a/features/statHistoryGui/index.js +++ b/features/statHistoryGui/index.js @@ -14,6 +14,7 @@ import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"; import { fetch } from "../../utils/networkUtils"; import SoopyImageElement from "../../../guimanager/GuiElement/SoopyImageElement"; import renderLibs from "../../../guimanager/renderLibs"; +import SoopyBoxElement from "../../../guimanager/GuiElement/SoopyBoxElement"; class StatHistoryGUI extends Feature { constructor() { @@ -79,6 +80,8 @@ class StatGraphPage extends GuiPage { } updateData(player) { + this.closeSidebarPage() + this.playerLoad = player this.statArea._scrollAmount = 0 @@ -124,28 +127,40 @@ class StatGraphPage extends GuiPage { let typeElm = new SoopyTextElement().setText("ยง0" + firstLetterWordCapital(type.replace("total", ""))).setMaxTextScale(2).setLocation(0.1, y, 0.8, 0.1) this.statArea.addChild(typeElm) y += 0.15 - let x = 0.05 - Object.keys(graphData[type]).forEach((graph, i) => { - renderLibs.getImage(graphData[type][graph], true) //load image synchronously into cache so it knows the height - console.log(graphData[type][graph]) - let graphElm = new SoopyImageElement() - this.statArea.addChild(graphElm) - graphElm.setImage(graphData[type][graph]) - - if (i === 0) { - graphElm.setLocation(0.1, y, 0.8, 0.25) - graphElm.loadHeightFromImage() - y += graphElm.location.size.y.get() + 0.05 - } else { - graphElm.setLocation(x, y, 0.4, 0.25) - graphElm.loadHeightFromImage() - x += 0.5 - if (x > 0.7 || i === Object.keys(graphData[type]).length - 1) { - x = 0.05 - y += graphElm.location.size.y.get() + 0.05 - } - } - }) + let graph = Object.keys(graphData[type])[0] + renderLibs.getImage(graphData[type][graph], true) //load image synchronously into cache so it knows the height + let graphElm = new SoopyImageElement() + this.statArea.addChild(graphElm) + graphElm.setImage(graphData[type][graph]) + + graphElm.setLocation(0.1, y, 0.8, 0.25) + graphElm.loadHeightFromImage() + y += graphElm.location.size.y.get() + 0.05 + + if (Object.keys(graphData[type]).length > 1) { + graphElm.setLore(["Click to show more graphs"]) + graphElm.addEvent(new SoopyMouseClickEvent().setHandler(() => { + let sideBarElm = new SoopyGuiElement().setLocation(0, 0, 1, 1) + sideBarElm.scrollable = true + this.openSidebarPage(sideBarElm) + let y2 = 0.05 + new Thread(() => { + Object.keys(graphData[type]).forEach((graph, i) => { + if (i === 0) return + renderLibs.getImage(graphData[type][graph], true) //load image synchronously into cache so it knows the height + let graphElm = new SoopyImageElement() + sideBarElm.addChild(graphElm) + graphElm.setImage(graphData[type][graph]) + + graphElm.setLocation(0.1, y2, 0.8, 0.25) + graphElm.loadHeightFromImage() + y2 += graphElm.location.size.y.get() + 0.05 + }) + }).start() + + })) + } + }) }).start() }) |