Skip to content

Commit

Permalink
🐛 Remove added shot types on reset
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenank committed Sep 22, 2023
1 parent ea2f608 commit 9786377
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions js/details/modal/main-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
setCustomSetup,
resetCustomSetupUploadFlag,
getCustomSetup,
existsDetail,
} from "../details-functions.js";
import { createDetailsPanel } from "../details-panel.js";
import { shotTypeLegend, teamLegend } from "../../shots/legend.js";
Expand Down Expand Up @@ -65,6 +66,20 @@ function createMainPage(id) {
.text("Reset to Defaults")
.on("click", () => {
setCustomSetup(getDefaultSetup());
if (existsDetail("#shot-type")) {
let options = _.find(getDefaultSetup().details, {
type: "shot-type",
id: "shot-type",
}).options;
d3.select("#shot-type-select").selectAll("option").remove();
d3.select("#shot-type-select")
.selectAll("option")
.data(options)
.enter()
.append("option")
.text((o) => o.value)
.property("selected", (o) => o.selected);
}
createMainPage(id);
select2Dropdown();
});
Expand Down

0 comments on commit 9786377

Please sign in to comment.