Skip to content

Commit

Permalink
Fix more deprecation warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wibble199 committed Feb 24, 2025
1 parent 20fe5e5 commit a1f15fa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
8 changes: 6 additions & 2 deletions module/applications/terrain-types-config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class TerrainTypesConfig extends FormApplication {
const formData = super._getSubmitData(updateData);

/** @type {(TerrainType & { isZone: boolean; })[]} */
const terrainTypes = Object.entries(expandObject(formData))
const terrainTypes = Object.entries(foundry.utils.expandObject(formData))
.sort((a, b) => a[0] - b[0])
.map(([_, value]) => value);

Expand Down Expand Up @@ -135,7 +135,11 @@ export class TerrainTypesConfig extends FormApplication {
this.sync();
const { terrainTypeId } = event.currentTarget.closest("[data-terrain-type-id]").dataset;
const existingTerrainType = this.object.find(t => t.id === terrainTypeId);
const newTerrainType = { ...existingTerrainType, id: randomID(), name: existingTerrainType.name + " (2)" };
const newTerrainType = {
...existingTerrainType,
id: foundry.utils.randomID(),
name: existingTerrainType.name + " (2)"
};
this.object.push(newTerrainType);
this._expandedTypes[newTerrainType.id] = true;
this.render();
Expand Down
2 changes: 1 addition & 1 deletion module/utils/terrain-types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { alphaToHex } from "./misc-utils.mjs";
*/
export function createDefaultTerrainType(id = undefined) {
return {
id: id ?? randomID(),
id: id ?? foundry.utils.randomID(),
name: "New Terrain Type",
usesHeight: true,
isSolid: true,
Expand Down
4 changes: 4 additions & 0 deletions styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ ul.terrain-type-palette li .terrain-type-name {
font-family: Consolas, Courier New, Courier, monaco, monospace;
}

#tht_terrainTypesConfig file-picker {
align-items: stretch;
}


/* --------------------------- */
/* Terrain Types Import/Export */
Expand Down
9 changes: 4 additions & 5 deletions templates/terrain-types-config.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

<div class="form-group-stacked">
<label>{{localize "DRAWING.StrokeColor"}}</label>
{{colorPicker name=(concat idx ".lineColor") value=terrainType.lineColor}}
<color-picker name="{{idx}}.lineColor" value="{{terrainType.lineColor}}" />
</div>

<div class="form-group-stacked">
Expand Down Expand Up @@ -84,7 +84,7 @@

<div class="form-group-stacked">
<label>{{localize "DRAWING.FillColor"}}</label>
{{colorPicker name=(concat idx ".fillColor") value=terrainType.fillColor}}
<color-picker name="{{idx}}.fillColor" value="{{terrainType.fillColor}}" />
</div>

<div class="form-group-stacked">
Expand All @@ -97,8 +97,7 @@
<div class="form-group-stacked">
<label>{{localize "DRAWING.FillTexture"}}</label>
<div class="form-group">
{{filePicker target=(concat idx ".fillTexture") type="image"}}
<input class="image" type="text" name="{{idx}}.fillTexture" placeholder="path/image.png" value="{{terrainType.fillTexture}}"/>
<file-picker name="{{idx}}.fillTexture" type="image" value="{{terrainType.fillTexture}}"></file-picker>
</div>
</div>

Expand Down Expand Up @@ -153,7 +152,7 @@

<div class="form-group-stacked">
<label>{{localize "DRAWING.TextColor"}}</label>
{{colorPicker name=(concat idx ".textColor") value=terrainType.textColor}}
<color-picker name="{{idx}}.textColor" value="{{terrainType.textColor}}" />
</div>

<div class="form-group-stacked">
Expand Down

0 comments on commit a1f15fa

Please sign in to comment.