diff --git a/languages/en.json b/languages/en.json index 7b66838..5e09991 100644 --- a/languages/en.json +++ b/languages/en.json @@ -27,41 +27,41 @@ }, "editForm": { "title": "Title", - "titleTooltip": "Set the title of the challenge tracker", + "titleTooltip": "The title of the challenge tracker", "size": "Size", - "sizeTooltip": "Set the size of the challenge tracker in pixels", + "sizeTooltip": "The size of the challenge tracker in pixels", "show": "Show to Others", "showTooltip": "Show the challenge tracker to others", "windowed": "Windowed", "windowedTooltip": "Display the challenge tracker in a window", "outerTitle": "Outer Track", "outerTotal": "Total Segments", - "outerTotalTooltip": "Set the number of segments on the outer ring", + "outerTotalTooltip": "The number of total segments on the outer track", "outerCurrent": "Current Segments", - "outerCurrentTooltip": "Set the number of current segments on the outer ring", - "outerColor": "Color", - "outerColorTooltip": "Set the hex color of the outer ring", - "outerBackgroundColor": "Background Color", - "outerBackgroundColorTooltip": "Set the background hex color of the outer ring", + "outerCurrentTooltip": "The number of currently set segments on the outer track", + "outerBackgroundColor": "Unset Color", + "outerBackgroundColorTooltip": "The hex color of unset segments on the outer track", + "outerColor": "Set Color", + "outerColorTooltip": "The hex color of the set segments on the outer track", "innerTitle": "Inner Track", "innerTotal": "Total Segments", - "innerTotalTooltip": "Set the number of segments on the inner circle", + "innerTotalTooltip": "The number of total segments on the inner track", "innerCurrent": "Current Segments", - "innerCurrentTooltip": "Set the number of current segments on the inner circle", - "innerColor": "Color", - "innerColorTooltip": "Set the hex color of the inner circle", - "innerBackgroundColor": "Background Color", - "innerBackgroundColorTooltip": "Set the background hex color of the inner circle", + "innerCurrentTooltip": "The number of currently set segments on the inner track", + "innerBackgroundColor": "Unset Color", + "innerBackgroundColorTooltip": "The hex color of the unset segments on the inner track", + "innerColor": "Set Color", + "innerColorTooltip": "The hex color of the set segments on the inner track", "imageTitle": "Images", - "image": "Image", - "imageTooltip": "Set the image for the current segments", "backgroundImage": "Background Image", - "backgroundImageTooltip": "Set the background image", + "backgroundImageTooltip": "The background image of the challenge tracker", + "foregroundImage": "Set Image", + "foregroundImageTooltip": "The image of the set segments on the outer and inner track", "frameTitle": "Frame", "frameWidth": "Width", - "frameWidthTooltip": "Set the width of the frame", + "frameWidthTooltip": "The width of the frame", "frameColor": "Color", - "frameColorTooltip": "Set the hex color of the frame", + "frameColorTooltip": "The hex color of the frame", "save": "Save and Close" }, "fuzzyQuery": "Did you mean '{fuzzyResult}'?" @@ -106,22 +106,22 @@ }, "outerBackgroundColor" : { "name": "Outer Background Color", - "hint": "Set the default background color of the outer ring", + "hint": "Set the default background color of the outer track", "label": "Color Picker" }, "outerColor" : { "name": "Outer Color", - "hint": "Set the default color of the outer ring", + "hint": "Set the default color of the outer track", "label": "Color Picker" }, "innerBackgroundColor" : { "name": "Inner Background Color", - "hint": "Set the default background color of the inner circle", + "hint": "Set the default background color of the inner track", "label": "Color Picker" }, "innerColor" : { "name": "Inner Color", - "hint": "Set the default color of the inner circle", + "hint": "Set the default color of the inner track", "label": "Color Picker" }, "frameColor" : { diff --git a/scripts/challenge-tracker.js b/scripts/challenge-tracker.js index 64618c1..f50504e 100644 --- a/scripts/challenge-tracker.js +++ b/scripts/challenge-tracker.js @@ -27,8 +27,8 @@ Hooks.once('socketlib.ready', () => { Hooks.once('ready', async () => { if (game.user.isGM) { - if (!ColorPicker) { - ui.notifications.notify("Challenge Tracker: To use the color pickers, enable the 'ColorPicker for Foundry VTT' module.") + if (typeof ColorPicker === 'undefined') { + ui.notifications.notify("Challenge Tracker: To use this module, install and enable the 'Color Picker' module.") } } diff --git a/scripts/compatibility.js b/scripts/compatibility.js index f5348b0..043e738 100644 --- a/scripts/compatibility.js +++ b/scripts/compatibility.js @@ -1,7 +1,7 @@ export class ChallengeTrackerCompatibility { // Fix for minimal UI's autohide/toggle static minmalUiPlayerList (html) { - if (game.modules.get('minimal-ui').active) { + if (game.modules.get('minimal-ui')?.active) { const playersListElement = html.find('#player-list') const minimalUiPlayerListSetting = game.settings.get('minimal-ui', 'playerList') if (minimalUiPlayerListSetting === 'autohide') { diff --git a/scripts/forms.js b/scripts/forms.js index 2f7c6bf..eec09c2 100644 --- a/scripts/forms.js +++ b/scripts/forms.js @@ -174,7 +174,7 @@ export class ChallengeTrackerEditForm extends FormApplication { const overrides = { height: 'auto', - width: '300px', + width: '400px', id: 'challenge-tracker-edit-form', template: ChallengeTrackerSettings.templates.challengeTrackerEditForm, title: game.i18n.localize('challengeTracker.labels.challengeTrackerEditFormTitle'), @@ -197,7 +197,7 @@ export class ChallengeTrackerEditForm extends FormApplication { frameColor: null, frameWidth: 'medium', id: `${ChallengeTrackerSettings.id}-${Math.random().toString(16).slice(2)}`, - image: null, + foregroundImage: null, innerBackgroundColor: null, innerColor: null, innerCurrent: 0, @@ -230,7 +230,7 @@ export class ChallengeTrackerEditForm extends FormApplication { static async open (ownerId, challengeTrackerId = null) { ChallengeTrackerEditForm.challengeTrackerEditForm.ownerId = ownerId ChallengeTrackerEditForm.challengeTrackerEditForm.challengeTrackerId = challengeTrackerId - ChallengeTrackerEditForm.challengeTrackerEditForm.render(true) + ChallengeTrackerEditForm.challengeTrackerEditForm.render(true, { width: '400px', height: 'auto' }) } activateListeners (html) { diff --git a/scripts/main.js b/scripts/main.js index 0abff93..5fef428 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -11,7 +11,7 @@ export class ChallengeTrackerSettings { 'frameColor', 'frameWidth', 'id', - 'image', + 'foregroundImage', 'innerBackgroundColor', 'innerColor', 'innerCurrent', @@ -45,7 +45,7 @@ export class ChallengeTracker extends Application { frameColor: null, frameWidth: null, id: null, - image: null, + foregroundImage: null, innerBackgroundColor: null, innerColor: null, innerCurrent: 0, @@ -111,7 +111,7 @@ export class ChallengeTracker extends Application { this.size = null this.windowed = null this.backgroundImage = new Image() - this.image = new Image() + this.foregroundImage = new Image() //this.setVariables() // Set values from challengeTrackerOptions or module settings for local variables // Canvas @@ -146,8 +146,8 @@ export class ChallengeTracker extends Application { this.windowed = this.challengeTrackerOptions.windowed ?? game.settings.get('challenge-tracker', 'windowed') - if (this.challengeTrackerOptions.image && this.image.src !== this.challengeTrackerOptions.image) { - this.image.src = this.challengeTrackerOptions.image + if (this.challengeTrackerOptions.foregroundImage && this.foregroundImage.src !== this.challengeTrackerOptions.foregroundImage) { + this.foregroundImage.src = this.challengeTrackerOptions.foregroundImage } if (this.challengeTrackerOptions.backgroundImage && this.backgroundImage.src !== this.challengeTrackerOptions.backgroundImage) { this.backgroundImage.src = this.challengeTrackerOptions.backgroundImage @@ -178,7 +178,7 @@ export class ChallengeTracker extends Application { let counter = 0 while ( ( - (this.challengeTrackerOptions.image && !this.image.complete) || + (this.challengeTrackerOptions.foregroundImage && !this.foregroundImage.complete) || (this.challengeTrackerOptions.backgroundImage && !this.backgroundImage.complete) ) && counter < 10 @@ -196,7 +196,7 @@ export class ChallengeTracker extends Application { * @param {string} challengeTrackerOptions.backgroundImage Background image link * @param {string} challengeTrackerOptions.frameColor Hex color of the frame * @param {string} challengeTrackerOptions.id Unique identifier of the challenge tracker - * @param {string} challengeTrackerOptions.image Image link + * @param {string} challengeTrackerOptions.foregroundImage Foreground image link * @param {string} challengeTrackerOptions.innerBackgroundColor Hex color of the inner circle background * @param {string} challengeTrackerOptions.innerColor Hex color of the inner circle * @param {number} challengeTrackerOptions.innerCurrent Number of filled segments of the inner circle @@ -227,7 +227,7 @@ export class ChallengeTracker extends Application { frameColor: null, frameWidth: null, id: null, - image: null, + foregroundImage: null, innerBackgroundColor: null, innerColor: null, innerCurrent: 0, @@ -349,10 +349,10 @@ export class ChallengeTracker extends Application { /** * Open Challenge Tracker by id or open a new Challenge Tracker * @param {array} [challengeTrackerOptions] Challenge Tracker Options - * @param {string} challengeTrackerOptions.backgroundImage Background image link + * @param {string} challengeTrackerOptions.backgroundImage Background image link * @param {string} challengeTrackerOptions.frameColor Hex color of the frame * @param {string} challengeTrackerOptions.id Unique identifier of the challenge tracker - * @param {string} challengeTrackerOptions.image Image link + * @param {string} challengeTrackerOptions.foregroundImage Foreground image link * @param {string} challengeTrackerOptions.innerBackgroundColor Hex color of the inner circle background * @param {string} challengeTrackerOptions.innerColor Hex color of the inner circle * @param {number} challengeTrackerOptions.innerCurrent Number of filled segments of the inner circle @@ -677,7 +677,7 @@ export class ChallengeTracker extends Application { * @param {string} challengeTrackerOptions.backgroundImage Background image link * @param {string} challengeTrackerOptions.frameColor Hex color of the frame * @param {string} challengeTrackerOptions.id Unique identifier of the challenge tracker - * @param {string} challengeTrackerOptions.image Image link + * @param {string} challengeTrackerOptions.foregroundImage Foreground image link * @param {string} challengeTrackerOptions.innerBackgroundColor Hex color of the inner circle background * @param {string} challengeTrackerOptions.innerColor Hex color of the inner circle * @param {number} challengeTrackerOptions.innerCurrent Number of filled segments of the inner circle @@ -725,7 +725,7 @@ export class ChallengeTracker extends Application { * @param {string} challengeTrackerOptions.backgroundImage Background image link * @param {string} challengeTrackerOptions.frameColor Hex color of the frame * @param {string} challengeTrackerOptions.id Unique identifier of the challenge tracker - * @param {string} challengeTrackerOptions.image Image link + * @param {string} challengeTrackerOptions.foregroundImage Foreground image link * @param {string} challengeTrackerOptions.innerBackgroundColor Hex color of the inner circle background * @param {string} challengeTrackerOptions.innerColor Hex color of the inner circle * @param {number} challengeTrackerOptions.innerCurrent Number of filled segments of the inner circle @@ -759,7 +759,7 @@ export class ChallengeTracker extends Application { * @param {string} challengeTrackerOptions.backgroundImage Background image link * @param {string} challengeTrackerOptions.frameColor Hex color of the frame * @param {string} challengeTrackerOptions.id Unique identifier of the challenge tracker - * @param {string} challengeTrackerOptions.image Image link + * @param {string} challengeTrackerOptions.foregroundImage Foreground image link * @param {string} challengeTrackerOptions.innerBackgroundColor Hex color of the inner circle background * @param {string} challengeTrackerOptions.innerColor Hex color of the inner circle * @param {number} challengeTrackerOptions.innerCurrent Number of filled segments of the inner circle @@ -840,7 +840,7 @@ export class ChallengeTracker extends Application { contextImage.clearRect(0, 0, canvasSize, canvasSize) // DRAW FOREGROUND IMAGE - if (this.challengeTrackerOptions.image) { + if (this.challengeTrackerOptions.foregroundImage) { if (this.challengeTrackerOptions.outerCurrent > 0) { contextImage.beginPath() contextImage.moveTo(halfCanvasSize, halfCanvasSize) @@ -875,7 +875,7 @@ export class ChallengeTracker extends Application { contextImage.closePath() } contextImage.globalCompositeOperation = 'source-atop' - contextImage.drawImage(this.image, lineWidth, lineWidth, canvasSize - (lineWidth * 2), canvasSize - (lineWidth * 2)) + contextImage.drawImage(this.foregroundImage, lineWidth, lineWidth, canvasSize - (lineWidth * 2), canvasSize - (lineWidth * 2)) } // DRAW BACKGROUND IMAGE @@ -1463,7 +1463,7 @@ export class ChallengeTracker extends Application { * @param {string} challengeTrackerOptions.backgroundImage Background image link * @param {string} challengeTrackerOptions.frameColor Hex color of the frame * @param {string} challengeTrackerOptions.id Unique identifier of the challenge tracker - * @param {string} challengeTrackerOptions.image Image link + * @param {string} challengeTrackerOptions.foregroundImage Foreground image link * @param {string} challengeTrackerOptions.innerBackgroundColor Hex color of the inner circle background * @param {string} challengeTrackerOptions.innerColor Hex color of the inner circle * @param {number} challengeTrackerOptions.innerCurrent Number of filled segments of the inner circle @@ -1512,7 +1512,7 @@ export class ChallengeTracker extends Application { * @param {string} challengeTrackerOptions.backgroundImage Background image link * @param {string} challengeTrackerOptions.frameColor Hex color of the frame * @param {string} challengeTrackerOptions.id Unique identifier of the challenge tracker - * @param {string} challengeTrackerOptions.image Image link + * @param {string} challengeTrackerOptions.foregroundImage Foreground image link * @param {string} challengeTrackerOptions.innerBackgroundColor Hex color of the inner circle background * @param {string} challengeTrackerOptions.innerColor Hex color of the inner circle * @param {number} challengeTrackerOptions.innerCurrent Number of filled segments of the inner circle @@ -1711,7 +1711,7 @@ export class ChallengeTracker extends Application { * @param {string} challengeTrackerOptions.backgroundImage Background image link * @param {string} challengeTrackerOptions.frameColor Hex color of the frame * @param {string} challengeTrackerOptions.id Unique identifier of the challenge tracker - * @param {string} challengeTrackerOptions.image Image link + * @param {string} challengeTrackerOptions.foregroundImage Foreground image link * @param {string} challengeTrackerOptions.innerBackgroundColor Hex color of the inner circle background * @param {string} challengeTrackerOptions.innerColor Hex color of the inner circle * @param {number} challengeTrackerOptions.innerCurrent Number of filled segments of the inner circle diff --git a/styles/challenge-tracker.css b/styles/challenge-tracker.css index d63929a..8c99f7b 100644 --- a/styles/challenge-tracker.css +++ b/styles/challenge-tracker.css @@ -160,9 +160,16 @@ padding-top: 0; } +.challenge-tracker-form-file-picker-group { + display: flex; +} + .challenge-tracker-edit-form { - width: 300px !important; + padding: 0 0.5em 0.5em 0; + width: 400px !important; row-gap: 2px; + overflow: auto; + max-height: 600px } .challenge-tracker-submit-button { diff --git a/templates/challenge-tracker-edit-form.hbs b/templates/challenge-tracker-edit-form.hbs index bfbb7cd..77d3190 100644 --- a/templates/challenge-tracker-edit-form.hbs +++ b/templates/challenge-tracker-edit-form.hbs @@ -29,14 +29,14 @@ +