Skip to content

Commit

Permalink
Make the region behavior config scrollable
Browse files Browse the repository at this point in the history
  • Loading branch information
dev7355608 committed Oct 14, 2024
1 parent d00ff73 commit ee1ba86
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"email": "[email protected]"
}
],
"version": "2.0.0",
"version": "2.0.1",
"compatibility": {
"minimum": "12",
"verified": "12"
Expand All @@ -33,8 +33,8 @@
],
"url": "https://github.com/dev7355608/limits",
"manifest": "https://github.com/dev7355608/limits/releases/latest/download/module.json",
"download": "https://github.com/dev7355608/limits/releases/download/v2.0.0/module.zip",
"changelog": "https://github.com/dev7355608/limits/releases/tag/v2.0.0",
"download": "https://github.com/dev7355608/limits/releases/download/v2.0.1/module.zip",
"changelog": "https://github.com/dev7355608/limits/releases/tag/v2.0.1",
"bugs": "https://github.com/dev7355608/limits/issues",
"readme": "https://raw.githubusercontent.com/dev7355608/limits/main/README.md",
"license": "https://raw.githubusercontent.com/dev7355608/limits/main/LICENSE"
Expand Down
15 changes: 10 additions & 5 deletions scripts/_index.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import LimitRangeRegionBehaviorConfig from "./apps/region-behavior.mjs";
import { PointDarknessSourceMixin, PointLightSourceMixin, PointSoundSourceMixin, PointVisionSourceMixin } from "./canvas/sources/_module.mjs";
import LimitRangeRegionBehaviorType from "./data/region-behavior.mjs";

Hooks.once("init", () => {
const type = "limits.limitRange";
const TYPE = "limits.limitRange";

CONFIG.RegionBehavior.dataModels[type] = LimitRangeRegionBehaviorType;
CONFIG.RegionBehavior.typeIcons[type] = "fa-solid fa-eye-low-vision";
CONFIG.RegionBehavior.typeLabels[type] = "LIMITS.label";
Hooks.once("init", () => {
CONFIG.RegionBehavior.dataModels[TYPE] = LimitRangeRegionBehaviorType;
CONFIG.RegionBehavior.typeIcons[TYPE] = "fa-solid fa-eye-low-vision";
CONFIG.RegionBehavior.typeLabels[TYPE] = "LIMITS.label";

Hooks.once("setup", () => {
Hooks.once("canvasInit", () => {
Expand Down Expand Up @@ -37,3 +38,7 @@ Hooks.once("init", () => {
});
});
});

Hooks.once("ready", () => {
CONFIG.RegionBehavior.sheetClasses[TYPE]["core.RegionBehaviorConfig"].cls = LimitRangeRegionBehaviorConfig;
});
1 change: 1 addition & 0 deletions scripts/_module.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export { default as Limits } from "./limits.mjs";

export * as apps from "./apps/_module.mjs";
export * as canvas from "./canvas/_module.mjs";
export * as const from "./const.mjs";
export * as data from "./data/_module.mjs";
Expand Down
1 change: 1 addition & 0 deletions scripts/apps/_module.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as LimitRangeRegionBehaviorConfig } from "./region-behavior.mjs";
17 changes: 17 additions & 0 deletions scripts/apps/region-behavior.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* The "Limit Range" Region Behavior Config.
* @sealed
*/
export default class LimitRangeRegionBehaviorConfig extends foundry.applications.sheets.RegionBehaviorConfig {
/** @override */
static PARTS = foundry.utils.mergeObject(super.PARTS, { form: { scrollable: [""] } }, { inplace: false });

/** @override */
async _renderHTML(context, options) {
const rendered = await super._renderHTML(context, options);

rendered.form.classList.add("scrollable");

return rendered;
}
}

0 comments on commit ee1ba86

Please sign in to comment.