Skip to content

Commit 41c35f2

Browse files
committed
Adjusted Task and Projects Dialog positioning to take account of the new header bar when running in mainWindow
1 parent da9f561 commit 41c35f2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎jgclark.Dashboard/src/react/components/Dialog.jsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22
//--------------------------------------------------------------------------
33
// Dashboard React component to show the Item Control and Project dialogs.
4-
// Last updated 30.6.2024 for v2.0.0-b17 by @dbw
4+
// Last updated 2026-01-07 for v2.4.0.b9 by @jgclark
55
//--------------------------------------------------------------------------
66

77
import React, { useEffect } from 'react'
@@ -147,7 +147,10 @@ const Dialog = ({ isOpen, onClose, isTask, details }: Props): React$Node => {
147147
function setPositionForDialog(thisOS: string, dialogWidth: number, dialogHeight: number, dialog: HTMLElement, event: TClickPosition) {
148148
logDebug('setPositionForDialog', `starting: thisOS=${thisOS} dialogWidth=${dialogWidth} dialogHeight=${dialogHeight} event=${JSON.stringify(event)}`)
149149
const fudgeFactor = 12 // small border (in pixels) to take account of scrollbars etc. round Left, Right, Bottom sides
150-
const fudgeFactorTop = 40 // border (in pixels) to take account of header bar which floats over the top
150+
// Get possible NP Editor header height from CSS variable, with fallback to 0
151+
const root = document.documentElement
152+
const headerHeight = parseInt(getComputedStyle(root).getPropertyValue('--noteplan-header-height') || '0', 10)
153+
const fudgeFactorTop = 40 + headerHeight // border (in pixels) to take account of NP Editor header bar (if shown)
151154
const fudgeFactorBottom = 40 // allow more bottom space, as the dialog may be taller than expected
152155

153156
// Get mouse positions (viewport-relative)

0 commit comments

Comments
 (0)