Skip to content

Commit

Permalink
Fixing bug in floating panel width initialisation.
Browse files Browse the repository at this point in the history
  • Loading branch information
DC23 committed Dec 17, 2024
1 parent 178931e commit cc658a1
Showing 1 changed file with 11 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

0 comments on commit cc658a1

Please sign in to comment.