remove unused setting and fix css gradient custom themes, 1.1.1
This commit is contained in:
parent
70929ef693
commit
3a2e6bddb0
2 changed files with 34 additions and 24 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "dh-feartrackerplus",
|
"id": "dh-feartrackerplus",
|
||||||
"title": "Daggerheart Fear Tracker Plus",
|
"title": "Daggerheart Fear Tracker Plus",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13",
|
"minimum": "13",
|
||||||
"verified": "13"
|
"verified": "13"
|
||||||
|
|
@ -32,6 +32,6 @@
|
||||||
],
|
],
|
||||||
"url": "https://github.com/cptn-cosmo/dh-feartrackerplus",
|
"url": "https://github.com/cptn-cosmo/dh-feartrackerplus",
|
||||||
"manifest": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/latest/download/module.json",
|
"manifest": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/latest/download/module.json",
|
||||||
"download": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/download/1.1.0/dh-feartrackerplus.zip",
|
"download": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/download/1.1.1/dh-feartrackerplus.zip",
|
||||||
"description": "Customizes the Fear Tracker for Daggerheart."
|
"description": "Customizes the Fear Tracker for Daggerheart."
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ Hooks.once('init', () => {
|
||||||
|
|
||||||
game.settings.register(MODULE_ID, 'fullColor', {
|
game.settings.register(MODULE_ID, 'fullColor', {
|
||||||
name: 'Full Icon Color',
|
name: 'Full Icon Color',
|
||||||
hint: 'CSS color string or gradient (Used if Theme is Custom).',
|
hint: 'CSS color string or gradient (e.g., "linear-gradient(90deg, red, blue)"). Used if Theme is Custom.',
|
||||||
scope: 'client',
|
scope: 'client',
|
||||||
config: true,
|
config: true,
|
||||||
type: String,
|
type: String,
|
||||||
|
|
@ -99,16 +99,6 @@ Hooks.once('init', () => {
|
||||||
onChange: refreshFearTracker
|
onChange: refreshFearTracker
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register(MODULE_ID, 'emptyColor', {
|
|
||||||
name: 'Empty Icon Color',
|
|
||||||
hint: 'CSS color string for inactive icons (Used if Theme is Custom).',
|
|
||||||
scope: 'client',
|
|
||||||
config: true,
|
|
||||||
type: String,
|
|
||||||
default: '#444444',
|
|
||||||
onChange: refreshFearTracker
|
|
||||||
});
|
|
||||||
|
|
||||||
game.settings.register(MODULE_ID, 'trackerScale', {
|
game.settings.register(MODULE_ID, 'trackerScale', {
|
||||||
name: 'Tracker Scale',
|
name: 'Tracker Scale',
|
||||||
hint: 'Resize the fear tracker (0.25x to 2.0x).',
|
hint: 'Resize the fear tracker (0.25x to 2.0x).',
|
||||||
|
|
@ -186,15 +176,12 @@ Hooks.on('renderSettingsConfig', (app, html, data) => {
|
||||||
|
|
||||||
// Color Inputs
|
// Color Inputs
|
||||||
const fullColorGroup = findGroup('fullColor');
|
const fullColorGroup = findGroup('fullColor');
|
||||||
const emptyColorGroup = findGroup('emptyColor');
|
|
||||||
|
|
||||||
if (fullColorGroup && emptyColorGroup) {
|
if (fullColorGroup) {
|
||||||
if (theme === 'custom') {
|
if (theme === 'custom') {
|
||||||
fullColorGroup.show();
|
fullColorGroup.show();
|
||||||
emptyColorGroup.show();
|
|
||||||
} else {
|
} else {
|
||||||
fullColorGroup.hide();
|
fullColorGroup.hide();
|
||||||
emptyColorGroup.hide();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -349,7 +336,7 @@ function injectFearCustomization(html) {
|
||||||
const customIcon = game.settings.get(MODULE_ID, 'customIcon');
|
const customIcon = game.settings.get(MODULE_ID, 'customIcon');
|
||||||
const colorTheme = game.settings.get(MODULE_ID, 'colorTheme');
|
const colorTheme = game.settings.get(MODULE_ID, 'colorTheme');
|
||||||
let fullColor = game.settings.get(MODULE_ID, 'fullColor');
|
let fullColor = game.settings.get(MODULE_ID, 'fullColor');
|
||||||
let emptyColor = game.settings.get(MODULE_ID, 'emptyColor');
|
let emptyColor = '#444444'; // Default for custom
|
||||||
|
|
||||||
// Theme Data for Interpolation
|
// Theme Data for Interpolation
|
||||||
let themeStart = null;
|
let themeStart = null;
|
||||||
|
|
@ -446,16 +433,42 @@ function injectFearCustomization(html) {
|
||||||
if (colorTheme !== 'foundryborne') {
|
if (colorTheme !== 'foundryborne') {
|
||||||
if (isInactive) {
|
if (isInactive) {
|
||||||
icon.style.background = emptyColor;
|
icon.style.background = emptyColor;
|
||||||
|
icon.style.backgroundSize = 'cover'; // Reset size for empty
|
||||||
|
icon.style.backgroundPosition = 'center'; // Reset pos for empty
|
||||||
} else {
|
} else {
|
||||||
// Active
|
// Active
|
||||||
if (themeStart && themeEnd && totalIcons > 1) {
|
if (themeStart && themeEnd && totalIcons > 1) {
|
||||||
// Interpolate
|
// Interpolate (Preset Themes)
|
||||||
const factor = index / (totalIcons - 1);
|
const factor = index / (totalIcons - 1);
|
||||||
const color = interpolateColor(themeStart, themeEnd, factor);
|
const color = interpolateColor(themeStart, themeEnd, factor);
|
||||||
icon.style.background = color;
|
icon.style.background = color;
|
||||||
|
icon.style.backgroundSize = 'cover';
|
||||||
|
icon.style.backgroundPosition = 'center';
|
||||||
} else {
|
} else {
|
||||||
// Custom or Single Color
|
// Custom Theme
|
||||||
|
// Check if fullColor appears to be a gradient
|
||||||
|
const isGradient = fullColor.includes('gradient');
|
||||||
|
|
||||||
|
if (isGradient && totalIcons > 0) {
|
||||||
icon.style.background = fullColor;
|
icon.style.background = fullColor;
|
||||||
|
icon.style.backgroundSize = `${totalIcons * 100}% 100%`;
|
||||||
|
|
||||||
|
// Calculate position
|
||||||
|
// Leftmost (index 0) = 0%
|
||||||
|
// Rightmost (index total-1) = 100%
|
||||||
|
let pos = 0;
|
||||||
|
if (totalIcons > 1) {
|
||||||
|
pos = (index / (totalIcons - 1)) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
icon.style.backgroundPosition = `${pos}% 0%`;
|
||||||
|
icon.style.backgroundAttachment = 'local'; // Ensure it sticks to the specific element config if needed, though default is usually fine.
|
||||||
|
} else {
|
||||||
|
// Solid Color
|
||||||
|
icon.style.background = fullColor;
|
||||||
|
icon.style.backgroundSize = 'cover';
|
||||||
|
icon.style.backgroundPosition = 'center';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -469,9 +482,6 @@ function injectFearCustomization(html) {
|
||||||
const animateMax = game.settings.get(MODULE_ID, 'maxFearAnimation');
|
const animateMax = game.settings.get(MODULE_ID, 'maxFearAnimation');
|
||||||
if (animateMax) {
|
if (animateMax) {
|
||||||
// Check if all available icons are active
|
// Check if all available icons are active
|
||||||
// Icons are "active" if they don't have the 'inactive' class.
|
|
||||||
// Wait, looking at the code above, 'inactive' class checks are used.
|
|
||||||
// Let's count totals.
|
|
||||||
const activeIcons = Array.from(icons).filter(icon => !icon.classList.contains('inactive')).length;
|
const activeIcons = Array.from(icons).filter(icon => !icon.classList.contains('inactive')).length;
|
||||||
|
|
||||||
// If totalIcons > 0 and activeIcons === totalIcons, apply animation
|
// If totalIcons > 0 and activeIcons === totalIcons, apply animation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue