Skip to content

Commit

Permalink
Improve reset() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
KirkMcDonald committed Oct 18, 2024
1 parent fe979da commit e33b46c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions display.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ class DisplayGroup {
}
}

export function resetDisplay() {
d3.selectAll("table#totals > tbody").remove()
displayGroups = []
}

// Remember these values from update to update, to make it simpler to reuse
// elements.
let displayGroups = []
Expand Down
5 changes: 5 additions & 0 deletions factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,5 +650,10 @@ class FactorySpecification {
}
}

export function resetSpec() {
spec = new FactorySpecification()
window.spec = spec
}

export let spec = new FactorySpecification()
window.spec = spec
5 changes: 4 additions & 1 deletion init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.*/
import { getBelts } from "./belt.js"
import { getBuildings } from "./building.js"
import { spec } from "./factory.js"
import { resetDisplay } from "./display.js"
import { spec, resetSpec } from "./factory.js"
import { loadSettings } from "./fragment.js"
import { getFuel } from "./fuel.js"
import { getItemGroups } from "./group.js"
Expand All @@ -25,6 +26,8 @@ import { currentMod, MODIFICATIONS, renderDataSetOptions, renderSettings } from

function reset() {
window.location.hash = ""
resetDisplay()
resetSpec()
}

export function changeMod() {
Expand Down

0 comments on commit e33b46c

Please sign in to comment.