ElvUI styling
Meivyn opened this issue ยท 7 comments
Hey, it's me again.
I'm still using your add-on, but it isn't skinned properly when you are using ElvUI. I wasn't using ElvUI before, so I didn't notice it.
I was able to manually fix it by editing both ElvUI's and your add-on's files, but it needs to be done again every updates and makes me sad.
ElvUI loops through MountJournal.ListScrollFrame.buttons
to skin each buttons. The problem is the loop is runned before your add-on updates its count to 17 instead of 12. As a result, only 12 buttons are skinned, as you can see here before/after my fix:
The workaround I used was to make your ModifyMountList()
function global and add this condition before ElvUI's loop:
if IsAddOnLoaded("MountJournalEnhanced") then
ModifyMountList()
end
I'm not sure when ElvUI uses its LoadSkin()
function, but a possible fix will be firing your ModifyMountList()
function at the same time instead of after it. Maybe by hooking it to another function or waiting for an event.
The same thing happens for Character Mounts count, I had to add this to your code:
if IsAddOnLoaded("ElvUI") then
frame:StripTextures()
end
Hi Meivyn,
Thank you, for reporting this issue.
To be honest I usually don't check UI overhauls, because I'm just using the default UI myself. BUT ElvUI has quiet a lot users, so I'm going to look into it. But it's probably going to take a while until I find the time for a proper solution.
(Note to myself: Maybe cloning the style/regions/textures of a reference frame might be a good approach.)
Hey. Sorry for the long wait. I got a little sidetracked.
Anyway the good news is that I found a nice way to fix the list and the character count elements. So thats going to be fixed in the coming version 2.3.
But I couldn't skin all my additions yet. Some elements - like the button in the DressUp frame - are still on my ToDo-List. It's sadly not that easy to access resources of ElvUI without touching it's code.
Hey, glad to see you back.
Looks like you managed to do it. One more minor issue though.
Again before/after my fix:
To be a perfect match with default ElvUI style pixel by pixel, I had to edit these lines in your function:
local function ModifyMountList()
local scrollFrame = MountJournal.ListScrollFrame
local buttons = MountJournal.ListScrollFrame.buttons
scrollFrame.buttons[1]:SetHeight(MOUNT_BUTTON_HEIGHT)
scrollFrame.buttons[1]:ClearAllPoints()
- scrollFrame.buttons[1]:SetPoint("TOPLEFT", scrollFrame.scrollChild, "TOPLEFT", 34, 0)
+ scrollFrame.buttons[1]:SetPoint("TOPLEFT", scrollFrame.scrollChild, "TOPLEFT", 44, 0)
HybridScrollFrame_CreateButtons(scrollFrame, "MountListButtonTemplate")
scrollBarMinMaxHandler = scrollFrame.scrollBar.SetMinMaxValues
scrollFrame.scrollBar.SetMinMaxValues = function()
end
for buttonIndex = 1, #buttons do
local button = buttons[buttonIndex]
- button:SetSize(220, MOUNT_BUTTON_HEIGHT)
+ button:SetHeight(MOUNT_BUTTON_HEIGHT)
button.DragButton:SetSize(MOUNT_BUTTON_HEIGHT, MOUNT_BUTTON_HEIGHT)
button.icon:SetSize(MOUNT_BUTTON_HEIGHT, MOUNT_BUTTON_HEIGHT)
button.icon:ClearAllPoints()
button.icon:SetPoint("RIGHT", button, "LEFT", -2, 0)
button.unusable:ClearAllPoints()
button.unusable:SetPoint("TOPLEFT", button.DragButton)
button.unusable:SetPoint("BOTTOMRIGHT", button.DragButton)
button.name:SetWidth(208)
button.name:ClearAllPoints()
button.name:SetPoint("LEFT", button, "LEFT", 10, 0)
button.new:ClearAllPoints()
button.new:SetPoint("CENTER", button.DragButton)
button.factionIcon:ClearAllPoints()
button.factionIcon:SetPoint("RIGHT", button, -1, 0)
hooksecurefunc(button.factionIcon, "SetAtlas", function(self)
self:SetSize(MOUNT_BUTTON_HEIGHT, MOUNT_BUTTON_HEIGHT)
end)
end
hooksecurefunc("HybridScrollFrame_Update", HookScrollUpdate)
end
But maybe this is an issue related to PixelPerfect. I'm not sure of it.
Thanks for your work!
Alright, that should do it now. I found a bit smoother way for the list. I hope that's now nice enough. ^^
I've added an Ace-Lib as well, so ElvUI can take care of my settings panel and DressUp button.
Thanks for your feedback so far.
Issue is fixed in version 2.3.1
Well, your changes have worked, there's no more overlap. You also fixed a problem that I had during my tests. The button.icon:SetPoint
didn't want to work (it was overwritten by ElvUI).
Speaking of that, what do you think of it? This is to make the compact list cleaner, and more consistent with Blizzard's default style. I validated the changes pixel by pixel using Photoshop.
Here's the result without ElvUI. You can notice that the icons are slightly smaller in the default UI compared to the name buttons. This also avoids the overlap issues that you could see on the first screenshot with ElvUI.
And here are my edits.
local function GenerateButtons()
local scrollFrame = MountJournal.ListScrollFrame
local buttons = scrollFrame.buttons
buttons[1]:SetHeight(MOUNT_BUTTON_HEIGHT)
buttons[1]:ClearAllPoints()
- buttons[1]:SetPoint("TOPLEFT", scrollFrame.scrollChild, "TOPLEFT", 34, 0)
+ buttons[1]:SetPoint("TOPLEFT", scrollFrame.scrollChild, 28, 0)
HybridScrollFrame_CreateButtons(scrollFrame, "MountListButtonTemplate")
scrollBarMinMaxHandler = scrollFrame.scrollBar.SetMinMaxValues
scrollFrame.scrollBar.SetMinMaxValues = function()
end
hooksecurefunc("HybridScrollFrame_Update", HookScrollUpdate)
end
local function ModifyListButtons()
for _, button in pairs(MountJournal.ListScrollFrame.buttons) do
- button:SetSize(220, MOUNT_BUTTON_HEIGHT)
+ button:SetSize(224, MOUNT_BUTTON_HEIGHT)
button.DragButton:SetSize(MOUNT_BUTTON_HEIGHT, MOUNT_BUTTON_HEIGHT)
- button.icon:SetSize(MOUNT_BUTTON_HEIGHT, MOUNT_BUTTON_HEIGHT)
+ button.icon:SetSize(MOUNT_BUTTON_HEIGHT - 8, MOUNT_BUTTON_HEIGHT - 8)
button.icon:ClearAllPoints()
- button.icon:SetPoint("RIGHT", button, "LEFT", -2, 0)
+ button.icon:SetPoint("LEFT", button, -24, 0)
button.unusable:ClearAllPoints()
button.unusable:SetPoint("TOPLEFT", button.DragButton)
button.unusable:SetPoint("BOTTOMRIGHT", button.DragButton)
button.name:ClearAllPoints()
- button.name:SetPoint("LEFT", button, "LEFT", 10, 0)
- button.name:SetPoint("RIGHT", button, "RIGHT", -10, 0)
+ button.name:SetPoint("LEFT", button, "LEFT", 8, 0)
+ button.name:SetPoint("RIGHT", button, "RIGHT", -8, 0)
button.new:ClearAllPoints()
button.new:SetPoint("CENTER", button.DragButton)
button.factionIcon:ClearAllPoints()
button.factionIcon:SetPoint('TOPRIGHT', -4, -4)
button.factionIcon:SetPoint('BOTTOMRIGHT', -4, 4)
hooksecurefunc(button.factionIcon, "SetAtlas", function(self)
self:SetSize(MOUNT_BUTTON_HEIGHT, MOUNT_BUTTON_HEIGHT)
end)
end
end
To be even more consistent with the look of Blizzard, you can partially display the 16th button.
local MOUNT_BUTTON_HEIGHT = 31
buttons[1]:SetPoint("TOPLEFT", scrollFrame.scrollChild, 29, 0)
button:SetSize(223, MOUNT_BUTTON_HEIGHT)
button.icon:SetPoint("LEFT", button, -25, 0)
Let me know what's your opinion on it.
Thanks!
I have also a question for you.
What's the point of using this
local ADDON_NAME, ADDON = ...
Instead of
local ADDON_NAME = ""
local ADDON = {}
What is ...
in this case?
Basically, ...[1] = ADDON_NAME
and ...[2] = ADDON_TABLE
by default?
I don't like the idea of shrinking the icon that much. Therefore I just the backdrop from ElvUI here just a bit bigger and added a little space between each line. It should still look nice and offer enough space for multi line names. :) (v.2.3.2)
Regarding the last question:
The WoW Client injects each lua file the current addon name and an empty table. The table instance is shared between each lua files of this addon. You can add your functions/variables to it and use them again in another lua file. It basically works like a protected namespace. So you can access your own resources, without exposing them publicly to all other addons. This allows for a more modular code, instead of collecting everything into one file.