Skip to content

Commit

Permalink
Merge pull request #3577 from foundryvtt/ui-tweaks
Browse files Browse the repository at this point in the history
Control hints & other UI tweaks
  • Loading branch information
arbron authored May 20, 2024
2 parents 4e019e0 + 4e0fc9c commit 60996e5
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 10 deletions.
1 change: 1 addition & 0 deletions icons/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ SVG Icons from Noun Project
The dnd5e system for Foundry Virtual Tabletop includes icon artwork licensed from various authors at TheNounProject.com under CC BY 3.0.

/svg/ink-pot.svg - "ink pot" by Creative Stall from https://thenounproject.com/icon/ink-pot-143149/
/svg/mouse.svg - "Mouse" by difatama from https://thenounproject.com/icon/mouse-6099417/
/svg/statuses/encumbered.svg - "Weight" by YANDI RS from https://thenounproject.com/icon/weight-4551693/
/svg/statuses/exceeding-carrying-capacity.svg - "Weight" by YANDI RS from https://thenounproject.com/icon/weight-4551693/
/svg/statuses/heavily-encumbered.svg - "Weight" by YANDI RS from https://thenounproject.com/icon/weight-4551693/
2 changes: 2 additions & 0 deletions icons/svg/mouse-middle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions icons/svg/mouse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@
"DND5E.BonusesHint": "Define global bonuses as formulas which are added to certain rolls. For example: 1d4 + 2",
"DND5E.BonusesInstructions": "Configure character bonuses which are added to the appropriate dice roll",
"DND5E.Conditions": "Conditions",
"DND5E.Controls": {
"Hint": "Enable various hints throughout the UI for certain mouse and keyboard controls.",
"LockHint": "Middle-click to lock",
"MiddleClick": "Middle Click",
"Name": "Enable Control Hints"
},
"DND5E.ChallengeRating": "Challenge Rating",
"DND5E.Charged": "Charged",
"DND5E.Charges": "Charges",
Expand Down
15 changes: 5 additions & 10 deletions less/v2/apps.less
Original file line number Diff line number Diff line change
Expand Up @@ -945,18 +945,13 @@
:is(.dnd5e2, .dnd5e2-journal) .window-resizable-handle {
border-radius: 0;
border: none;
background: transparent;
color: var(--dnd5e-color-black);
overflow: hidden;
font-size: 16px;
width: 11px;
height: 11px;
cursor: nwse-resize;
opacity: .4;
opacity: .7;
background: transparent url('ui/resize-handle.webp') no-repeat center / contain;

> i {
position: absolute;
bottom: -3px;
right: 1px;

&::before { content: "\f7a5"; }
}
> i { display: none; }
}
5 changes: 5 additions & 0 deletions less/v2/character.less
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
border-radius: 5px;
}

.window-resizable-handle {
bottom: 0;
right: 1px;
}

/* ---------------------------------- */
/* Outer Window */
/* ---------------------------------- */
Expand Down
21 changes: 21 additions & 0 deletions less/v2/tooltips.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@
border-radius: 4px;
pointer-events: none;
}

.lock-hint { display: none; }
}

.lock-hint {
display: flex;
justify-content: center;
align-items: center;
gap: 4px;
padding: 6px 0 0;
margin-bottom: -4px;
font-size: var(--font-size-10);
color: var(--color-text-dark-5);

> img {
height: 1em;
aspect-ratio: 1;
border: none;
transform: scale(1.35);
opacity: .6;
}
}

/* ---------------------------------- */
Expand Down
1 change: 1 addition & 0 deletions module/data/abstract.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ export class ItemDataModel extends SystemDataModel {
const context = {
name, type, img, price, weight, uses, school, materials, activation,
config: CONFIG.DND5E,
controlHints: game.settings.get("dnd5e", "controlHints"),
labels: foundry.utils.deepClone(this.parent.labels),
tags: this.parent.labels?.components?.tags,
subtitle: subtitle.filterJoin(" • "),
Expand Down
10 changes: 10 additions & 0 deletions module/settings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,16 @@ export function registerSystemSettings() {
type: PrimaryPartyData,
onChange: s => ui.actors.render()
});

// Control hints
game.settings.register("dnd5e", "controlHints", {
name: "DND5E.Controls.Name",
hint: "DND5E.Controls.Hint",
scope: "client",
config: true,
type: Boolean,
default: true
});
}

/**
Expand Down
6 changes: 6 additions & 0 deletions templates/items/parts/item-tooltip.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,10 @@
{{/each}}
{{/if}}
</ul>
{{#if controlHints}}
<div class="lock-hint">
<img src="systems/dnd5e/icons/svg/mouse-middle.svg" alt="{{ localize "DND5E.Controls.MiddleClick" }}">
<span>{{ localize "DND5E.Controls.LockHint" }}</span>
</div>
{{/if}}
</section>
Binary file added ui/resize-handle.webp
Binary file not shown.

0 comments on commit 60996e5

Please sign in to comment.