Pretty much at the tidy up phase for my addon now and still pulling hair out. I have the following code;
NS.MyScale = 1
print ("MyAddonScale: "..NS.MyAddonScale);
MyAddon:SetScale(MyScale)
In my addon to set the scale. That worked fine until I cut my dialog frames out and put them into their own files. The dialogs still load but the scale is weird. They appear to be ignoring the scale setting now. They’re far larger, at least 150% I’d guess (maybe even 200%).
I tried adding the same code to the dialogs but using a scale of “1” still results in huge dialogs. Scale still words, in a sense, because if I use
NS.MyDialogScale = .5
print ("MyAddonScale: "..NS.MyAddonScale);
MyAddon:SetScale(MyDialogScale)
Then I can get them back to roughly the size they should be at scale of “1”. I thought it might be because I had their framestrata set to DIALOG and maybe WoW was treating that differently. But I reset it to MEDIUM and scaling is still weird.
edit: Nope, I was wrong. Removing scale from the parent didn’t affect them at all. I tried removing the scale from the main form (which is the parent of the dialogs) and the scaling behaviour of the dialogs goes back to what I’d expect. So it looks like the scaling is somehow additive? I’m confused because it didn’t appear to be additive when they were all in the same lua file. It’s only once I split them into multiple files that it’s become a problem.
I’ve looked at: https://wowpedia.fandom.com/wiki/API_Region_SetScale
But I’m not sure how to interpret;
Since the API presentation is scaled, each object has its own internal notion of size, which is only relative to the actual size it appears on-screen.
UIParent
will have a reasonable scaling factor selected by the game engine, from which all of the child UI elements are then derived. This function can be used to selectively change the scale of a component relative to its parent such that it appears to become bigger or smaller. UI elements with appropriately specified anchor points and sizes should scale quite cleanly.
That seems to indicate that this weird scaling is based on the relationship between my child and parent frames which I’d figured out. But it doesn’t really explain why the child (dialog) is double size. I thought I had “UI elements with appropriately specified anchor points and sizes” but I guess not?
Latest edit: Incidentally, I tried
NS.MyAddonSettingsFrame:SetIgnoreParentScale(true);
NS.MyAddonsSettingsFrame:SetScale(NS.MyAddonScale);
print ("MyAdddonScale: "..NS.MyAddonScale);
print ("Effective scale: "..NS.MyAddonSettingsFrame:GetEffectiveScale());
if NS.MyAddonSettingsFrame:IsIgnoringParentScale() then
print ("Is ignoring parent scale: TRUE");
end
It returns:
MyAddonScale: 1
EffectiveScale: 1
Is ignoring parent scale: TRUE
So I’m still at a loss. It’s even ignoring the parent scale but still appearing far larger than it should be.