Skip to content

Commit

Permalink
- DF lib update
Browse files Browse the repository at this point in the history
  • Loading branch information
cont1nuity committed Jan 18, 2024
1 parent 461c7da commit 2b428c7
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 28 deletions.
3 changes: 2 additions & 1 deletion libs/DF/cooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local max = math.max

--api locals
local PixelUtil = PixelUtil or DFPixelUtil
local version = 19
local version = 20

local CONST_MENU_TYPE_MAINMENU = "main"
local CONST_MENU_TYPE_SUBMENU = "sub"
Expand Down Expand Up @@ -239,6 +239,7 @@ function DF:CreateCoolTip()
self:SetPoint("CENTER", UIParent, "CENTER", 0, 0)

if (not self.HaveRoundedCorners) then
self:SetBackdrop(nil)
DF:AddRoundedCornersToFrame(self, gameCooltip.RoundedFramePreset)
self:DisableRoundedCorners()
self.HaveRoundedCorners = true
Expand Down
2 changes: 1 addition & 1 deletion libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 502
local dversion = 504
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down
106 changes: 80 additions & 26 deletions libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1483,41 +1483,95 @@ end


------------color pick
local color_pick_func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe)
end
local color_pick_func_cancel = function()
ColorPickerFrame:SetColorRGB (unpack(ColorPickerFrame.previousValues))
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe)
end
local _, _, _, toc = GetBuildInfo()
if (toc >= 100205) then
local color_pick_func = function(...)
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe)
end

local color_pick_func_cancel = function()
local r, g, b, a = ColorPickerFrame.previousValues.r, ColorPickerFrame.previousValues.g, ColorPickerFrame.previousValues.b, ColorPickerFrame.previousValues.a
ColorPickerFrame.Content.ColorPicker:SetColorRGB(r, g, b)
ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe)
end

function detailsFramework:ColorPick(frame, r, g, b, alpha, callback)

ColorPickerFrame:ClearAllPoints()
ColorPickerFrame:SetPoint("bottomleft", frame, "topright", 0, 0)

ColorPickerFrame.dcallback = callback
ColorPickerFrame.dframe = frame

ColorPickerFrame.func = color_pick_func
ColorPickerFrame.opacityFunc = color_pick_func
ColorPickerFrame.cancelFunc = color_pick_func_cancel

ColorPickerFrame.opacity = alpha
ColorPickerFrame.hasOpacity = alpha and true

ColorPickerFrame.previousValues = {r, g, b}
ColorPickerFrame.previousAlpha = alpha
ColorPickerFrame:SetParent(UIParent)
ColorPickerFrame:SetFrameStrata("tooltip")

local info = {
swatchFunc = color_pick_func,
hasOpacity = alpha and true,
opacityFunc = color_pick_func,
opacity = alpha,
previousValues = {r = r, g = g, b = b, a = alpha},
cancelFunc = color_pick_func_cancel,
r = r,
g = g,
b = b,
}
--OpenColorPicker(info)
ColorPickerFrame:SetupColorPickerAndShow(info)

function detailsFramework:ColorPick (frame, r, g, b, alpha, callback)
end
else
local color_pick_func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe)
end
local color_pick_func_cancel = function()
ColorPickerFrame:SetColorRGB (unpack(ColorPickerFrame.previousValues))
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorPickerFrame:dcallback (r, g, b, a, ColorPickerFrame.dframe)
end

ColorPickerFrame:ClearAllPoints()
ColorPickerFrame:SetPoint("bottomleft", frame, "topright", 0, 0)
function detailsFramework:ColorPick (frame, r, g, b, alpha, callback)

ColorPickerFrame.dcallback = callback
ColorPickerFrame.dframe = frame
ColorPickerFrame:ClearAllPoints()
ColorPickerFrame:SetPoint("bottomleft", frame, "topright", 0, 0)

ColorPickerFrame.func = color_pick_func
ColorPickerFrame.opacityFunc = color_pick_func
ColorPickerFrame.cancelFunc = color_pick_func_cancel
ColorPickerFrame.dcallback = callback
ColorPickerFrame.dframe = frame

ColorPickerFrame.opacity = alpha
ColorPickerFrame.hasOpacity = alpha and true
ColorPickerFrame.func = color_pick_func
ColorPickerFrame.opacityFunc = color_pick_func
ColorPickerFrame.cancelFunc = color_pick_func_cancel

ColorPickerFrame.previousValues = {r, g, b}
ColorPickerFrame:SetParent(UIParent)
ColorPickerFrame:SetFrameStrata("tooltip")
ColorPickerFrame:SetColorRGB (r, g, b)
ColorPickerFrame:Show()
ColorPickerFrame.opacity = alpha
ColorPickerFrame.hasOpacity = alpha and true

ColorPickerFrame.previousValues = {r, g, b}
ColorPickerFrame:SetParent(UIParent)
ColorPickerFrame:SetFrameStrata("tooltip")
ColorPickerFrame:SetColorRGB (r, g, b)
ColorPickerFrame:Show()
end
end





------------icon pick
function detailsFramework:IconPick (callback, close_when_select, param1, param2)

Expand Down

0 comments on commit 2b428c7

Please sign in to comment.