Download CommonLua/UI/uiSafeArea.lua from sirnii/myspace: direct link, hf CLI and curl.
- Browser
- Download file 812 Bytes
-
https://huggingface.co/spaces/sirnii/myspace/resolve/main/CommonLua/UI/uiSafeArea.lua
- Command line
-
hf download hf://spaces/sirnii/myspace/CommonLua/UI/uiSafeArea.lua
-
curl -L -o uiSafeArea.lua https://huggingface.co/spaces/sirnii/myspace/resolve/main/CommonLua/UI/uiSafeArea.lua
812 Bytes
| local function percent(val, perc) | |
| return MulDivRound(val, perc, 100) | |
| end | |
| if FirstLoad then | |
| g_OpenSafeArea = false | |
| end | |
| DefineClass.XSafeArea = { | |
| __parents = { "XDialog" }, | |
| HAlign = "stretch", | |
| VAlign = "stretch", | |
| BorderWidth = 4, | |
| BorderColor = RGB(255,0,0), | |
| Translate = false, | |
| DrawOnTop = true, | |
| HandleMouse = false, | |
| FocusOnOpen = "", | |
| MarginPolicy = "FitInSafeArea", | |
| } | |
| function XSafeArea:Open(...) | |
| g_OpenSafeArea = self | |
| XDialog.Open(self, ...) | |
| end | |
| function XSafeArea:Close(...) | |
| g_OpenSafeArea = false | |
| XDialog.Close(self, ...) | |
| end | |
| function ToggleSafearea() | |
| if not g_OpenSafeArea then | |
| g_OpenSafeArea = XSafeArea:new({}, terminal.desktop) | |
| g_OpenSafeArea:Open() | |
| else | |
| if g_OpenSafeArea.window_state ~= "destroying" then | |
| g_OpenSafeArea:Close() | |
| g_OpenSafeArea = false | |
| end | |
| end | |
| end |