-
Notifications
You must be signed in to change notification settings - Fork 0
generateApplicationPosition
generateApplicationPosition is a method that returns the Partial<foundry.types.ApplicationPosition> you need to pass to setPosition or the position property of DEFAULT_OPTIONS when you create an ApplicationV2.
An options object. Each property is optional.
'auto' or a number greater than or equal to 1 is passed through. A number less than 1 is used to calculate the height as a percentage of the window height (e.g., 0.5 would calculate the height as half the window’s inner height).
Default: 0.5
'auto' or a number greater than or equal to 1 is passed through. A number less than 1 is used to calculate the width as a percentage of the window width (e.g., 0.5 would calculate the width as half the window’s inner width).
Default: 0.5
Distance in pixels from the left edge of the window where the application should appear.
Default: The panel is centered horizontally in the window.
Distance in pixels from the top edge of the window where the application should appear.
Default: The panel is centered vertically in the window.
The viewport in which the application will appear. Useful for testing, but probably best left to the default in production.
Default: window
A Partial<foundry.types.ApplicationPosition> that you can pass to setPosition or the position property of DEFAULT_OPTIONS when you create an ApplicationV2.
import { generateApplicationPosition } from '@revolutionarygamesco/common-foundryvtt'
new MyApplication({
position: generateApplicationPosition({ height: 2 / 3, width: 1 / 2 })
}).render(true)