EffectiveScale vs width and height
Hi again.
I've got a sort..of..viewport border around my screen which I've made to change colour depending on whether I'm in combat, resting, away, dead, etc. Is there a way to make a frame 'immune' to changes in scale? I've tried using, for example: Lua Code:
... instead of using a conventional fixed width, but surprisingly, even that doesn't remain the same size when scale is changed. EDIT: I know there isn't any OnScaleChanged handler that I can use. If I change the scale and re-submit the above code, all seems okay. Is there any way around this necessity? Is there a magic formula that I'm unaware of? Thanks in advance as always, Aanson |
Try setting the scale for the frame in code.
myFrame:SetScale(1) Ekat. |
Quote:
Now that I've slept on it, I don't think it can be done. There's just no way to respond to changes in scale. Hooking to the appropriate function would work perhaps but I prefer not to do that whenever possible. Cheers for the suggestion. |
You could just not parent the frame to UI Parent... Do you want it to hide when you hide the interface with Alt-Z?
|
I used SetPoint() to cover my viewport with a texture, like this:
Code:
local toppanel = CreateFrame("Frame", nil, UIParent) Code:
toppanel:SetPoint("TOPLEFT", -2, 0) Code:
toppanel:SetPoint("TOPLEFT", -2, 0) Using a small offset for x just to make sure there's no clipping (aka a little visual gap). Not necessarily needed, I suppose. |
frame:SetScale(1 / frame:GetParent():GetEffectiveScale())
|
Quote:
Kind Regs Aanson |
Quote:
Thank you very much as always and thank's everyone for your help. Aanson |
Having a parent is completely optional. The only reason to parent to UIParent is practically to be able to show and hide when the UI is shown or hidden and also scale with the rest of the UI. If you don't want to set a parent to a frame, you can pass nil to the respective function argument.
|
There's also the scaling issue -- if your frame doesn't descend from UIParent, then it annoyingly ignores the user's UI Scale preference.
|
All times are GMT -6. The time now is 04:18 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI