diff --git a/ElvUI_SLE/modules/vehicle.lua b/ElvUI_SLE/modules/vehicle.lua index b409f65..f73d95d 100644 --- a/ElvUI_SLE/modules/vehicle.lua +++ b/ElvUI_SLE/modules/vehicle.lua @@ -55,7 +55,7 @@ function EVB:CreateExtraButtonSet() bar.buttons[i] = LAB:CreateButton(i, T.format(bar:GetName().."Button%d", i), bar, nil); bar.buttons[i]:SetState(0, "action", i); - + for k = 1, 14 do bar.buttons[i]:SetState(k, "action", (k - 1) * 12 + i) end @@ -74,12 +74,39 @@ function EVB:CreateExtraButtonSet() end AB:StyleButton(bar.buttons[i], nil, nil, true); + if E.private.sle.actionbars.transparentButtons then bar.buttons[i].backdrop:SetTemplate('Transparent') end bar.buttons[i]:SetCheckedTexture("") RegisterStateDriver(bar.buttons[i], 'visibility', '[petbattle] hide; [vehicleui][overridebar][shapeshift][possessbar] show; hide') end end +function EVB:ButtonsSize() + if not self.bar then return end + for i = 1, #self.bar.buttons do + self.bar.buttons[i]:Size(self.size); + if (i == 1) then + self.bar.buttons[i]:SetPoint('BOTTOMLEFT', 2, 2) + else + local prev = i == 12 and self.bar.buttons[6] or self.bar.buttons[i-1]; + self.bar.buttons[i]:SetPoint('LEFT', prev, 'RIGHT', self.spacing, 0) + end + end + self.bar.buttons[12]:Size(self.size); + self.bar.buttons[12]:SetPoint('LEFT', self.bar.buttons[6], 'RIGHT', self.spacing, 0) +end + +function EVB:BarSize() + if not self.bar then return end + local bar = self.bar + + self.size = E.db.sle.actionbars.vehicle.buttonsize + self.spacing = E.db.sle.actionbars.vehicle.buttonspacing + + bar:SetWidth((self.size * 7) + (self.spacing * 6) + 4); + bar:SetHeight(self.size + 4); +end + function EVB:Initialize() if not SLE.initialized then return end if not E.private.sle.vehicle.enable or not E.private.actionbar.enable then return end; @@ -96,16 +123,12 @@ function EVB:Initialize() end end); - local size = 40; - local spacing = E:Scale(AB.db["bar1"].buttonspacing); local bar = CreateFrame("Frame", "ElvUISLEEnhancedVehicleBar", UIParent, "SecureHandlerStateTemplate"); bar.id = 1 + self.bar = bar; - self.size = size; - self.spacing = spacing; + EVB:BarSize() - bar:SetWidth((size * 7) + (spacing * 8)); - bar:SetHeight(size + (spacing * 2)); bar:SetTemplate("Transparent"); bar:CreateShadow(); if (E:GetModule("EnhancedShadows", true)) then @@ -137,9 +160,9 @@ function EVB:Initialize() self:Animate(bar, 0, -(bar:GetHeight()), 1); - self.bar = bar; - self:CreateExtraButtonSet(); + self:ButtonsSize() + E:CreateMover(bar, "EnhancedVehicleBar_Mover", L["Enhanced Vehicle Bar"], nil, nil, nil, "S&L,S&L MISC") AB:UpdateButtonConfig(bar, bindButtons); AB:PositionAndSizeBar("bar1") diff --git a/ElvUI_SLE/options/actionbars_c.lua b/ElvUI_SLE/options/actionbars_c.lua index 4e75f10..ef41c3a 100644 --- a/ElvUI_SLE/options/actionbars_c.lua +++ b/ElvUI_SLE/options/actionbars_c.lua @@ -1,6 +1,7 @@ local SLE, T, E, L, V, P, G = unpack(select(2, ...)) local A = SLE:GetModule("Actionbars") local AB = E:GetModule('ActionBars'); +local EVB = SLE:GetModule("EnhancedVehicleBar") local function configTable() if not SLE.initialized then return end @@ -83,6 +84,26 @@ local function configTable() get = function(info) return E.private.sle.vehicle.enable end, set = function(info, value) E.private.sle.vehicle.enable = value; E:StaticPopup_Show("PRIVATE_RL") end, }, + buttonsize = { + order = 4, + type = 'range', + name = L["Button Size"], + desc = L["The size of the action buttons."], + min = 15, max = 60, step = 1, + disabled = function() return not E.private.sle.vehicle.enable end, + get = function(info) return E.db.sle.actionbars.vehicle[ info[#info] ] end, + set = function(info, value) E.db.sle.actionbars.vehicle[ info[#info] ] = value; EVB:BarSize(); EVB:ButtonsSize() end, + }, + buttonspacing = { + order = 5, + type = 'range', + name = L["Button Spacing"], + desc = L["The spacing between buttons."], + min = -4, max = 20, step = 1, + disabled = function() return not E.private.sle.vehicle.enable end, + get = function(info) return E.db.sle.actionbars.vehicle[ info[#info] ] end, + set = function(info, value) E.db.sle.actionbars.vehicle[ info[#info] ] = value; EVB:BarSize(); EVB:ButtonsSize() end, + }, }, }, },