-
Notifications
You must be signed in to change notification settings - Fork 16
/
window.center.fmfn
29 lines (27 loc) · 1.17 KB
/
window.center.fmfn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* =====================================================
* window.center ( dimension )
*
* RETURNS: (int) Screen pixel value based on dimension
* supplied.
* REQUIRES: None
* NOTES: Using a locally scoped variable within your
* script will alter what this function returns
* $parentWindowHeight for window height of parent
* $parentWindowWidth for window width of parent
* $parentWindowTop for window top of parent
* $parentWindowLeft for window left of parent
* =====================================================
*/
Let ([
var.vertical = PatternCount ( dimension ; "vert" );
var.horizontal = PatternCount ( dimension ; "horiz" );
var.parentHeight = If ( IsEmpty ( $parentWindowHeight ) ; Get ( WindowDesktopHeight ) ; $parentWindowHeight );
var.parentWidth = If ( IsEmpty ( $parentWindowWidth ) ; Get ( WindowDesktopWidth ) ; $parentWindowWidth )
];
Case( var.vertical;
( var.parentHeight / 2) - ( Get ( WindowHeight ) / 2 ) + $parentWindowTop;
var.horizontal;
( var.parentWidth / 2) - ( Get ( WindowWidth ) / 2 ) + $parentWindowLeft
)
)