Skip to content

Commit 22745a0

Browse files
committed
practical changes
1 parent 4048fd1 commit 22745a0

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,15 @@ export class ConfigClass {
185185
if (inputTypes.includes(widget_object.type)) {
186186

187187
const element_id = "widget-input-" + this.datapack_id.toString() + i.toString();
188-
console.log(element_id); // this works
189188
const element_html = document.getElementById(element_id) as HTMLInputElement | null;
190-
console.log(element_html); // this equals null
191189

192190
if (element_html != null) {
193191
(widget_object as InputWidgetDefinition).inputted_value = parseFloat(element_html.value);
192+
if ((widget_object as InputWidgetDefinition).type === "slider") {
193+
if ((widget_object as SliderWidget).value.type === "percent") {
194+
(widget_object as InputWidgetDefinition).inputted_value = parseFloat(element_html.value) / 100;
195+
}
196+
}
194197
}
195198
}
196199
i += 1;

src/datapack_changes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export class DatapackModifier {
5454
application_method: method
5555
};
5656
this.changeQueue.push(change);
57+
console.log(`Queued change ${change.datapack.id} -> ${change.file_path} -> ${change.value_path} -> ${change.value} -> ${change.application_method}`);
5758
}
5859
else {
5960
console.warn(`Datapack change wasn't queued - value ${value} (type <${typeof value}>) doesn't match application method "${method}!"`);

src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,9 @@ const exportButtonElement = document.getElementById("export-button")!;
9999
exportButtonElement.addEventListener("click", exportButtonClicked, { passive: true });
100100

101101
function exportButtonClicked() {
102-
console.log("Export button clicked")
102+
console.log("Export button clicked");
103+
104+
datapackStore.getAll().forEach(datapack => {
105+
datapack.instancedConfig?.apply();
106+
});
103107
}

0 commit comments

Comments
 (0)