Skip to content

Commit

Permalink
Merge pull request #308 from DC23/307-floating-panel-line-wrap-still-…
Browse files Browse the repository at this point in the history
…isnt-quite-right

Another bugfix to the floating UI. Horizontal resizing should now work, and horizontal size should initialise correctly. Also reduced internal padding to give more room to display the time.
  • Loading branch information
DC23 authored Dec 17, 2024
2 parents 178931e + ef5f07d commit 3d97ce5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/uipanel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export class UIPanel extends HandlebarsApplicationMixin(ApplicationV2) {
frame: false,
title: 'JDTIMEKEEPING.title',
icon: 'fa-solid fa-clock',
resizable: false,
width: 'auto',
resizable: true, // only applies on the undocked UI
height: 'auto',
width: 'auto',
},
actions: {
'time-delta': UIPanel.timeDeltaButtonHandler,
Expand Down Expand Up @@ -49,11 +49,17 @@ export class UIPanel extends HandlebarsApplicationMixin(ApplicationV2) {
static create () {
const position = game.settings.get(MODULE_ID, SETTINGS.FLOATING_UI_PANEL_POSITION)

// if position if out of bounds for current client view, reset to a safe location in the top left
if (position) {
position.width = 'auto'
position.height = 'auto'
// for the floating panel, reset the auto width so it can resize manually
if (UIPanel.floatingPanel) {
if (position.width === 'auto') position.width = '220'
} else {
// when docked, restore auto width
position.width = 'auto'
}

// if position if out of bounds for current client view,
// reset to a safe location in the top left
if (
position.top > window.visualViewport.height ||
position.left > window.visualViewport.width
Expand Down
1 change: 1 addition & 0 deletions styles/easy-timekeeping.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@

[id^=jd-et-uipanel] .window-content {
background: var(--background-color);
padding: 0.5rem; /* It inherits 1rem, but it's too much. */
}

/*End*/
Expand Down

0 comments on commit 3d97ce5

Please sign in to comment.