Skip to content

Commit

Permalink
Minor fixes and rewording
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkinabout committed Sep 2, 2022
1 parent 6f7a846 commit 9cf6a3f
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 64 deletions.
46 changes: 23 additions & 23 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}'?"
Expand Down Expand Up @@ -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" : {
Expand Down
4 changes: 2 additions & 2 deletions scripts/challenge-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/compatibility.js
Original file line number Diff line number Diff line change
@@ -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') {
Expand Down
6 changes: 3 additions & 3 deletions scripts/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
36 changes: 18 additions & 18 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class ChallengeTrackerSettings {
'frameColor',
'frameWidth',
'id',
'image',
'foregroundImage',
'innerBackgroundColor',
'innerColor',
'innerCurrent',
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion styles/challenge-tracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 9cf6a3f

Please sign in to comment.