Fix a memory leak

`drop` does not remove an element in-place.
To learn what it does, I'll refer you to the scala collection docs.
This commit is contained in:
Fingercomp 2023-07-07 00:20:12 +07:00
parent a1b1b86b6b
commit 08539a025a
No known key found for this signature in database
GPG Key ID: BBC71CEE45D86E37

View File

@ -51,10 +51,11 @@ class ComputerWindow(computerAware: ComputerAware) extends BasicWindow {
private var lastTick = OcelotDesktop.ticker.tick
def appendHistoryValue(value: Float): Unit = {
history.append(value)
if (history.length > historySize) {
history.remove(0)
}
if (history.length > historySize)
history.drop(0)
history.append(value)
}
def tickUpdate(): Unit = {}