diff --git a/README.md b/README.md
index 38aced1..9d2d3f0 100644
--- a/README.md
+++ b/README.md
@@ -114,12 +114,13 @@ Demo2: FN Call Args: `t=Frame.Frame2.Frame3` => someFunction(_G.Frame.Frame2.Fra
ViragDevTool is in beta so there is lots of stuff to add and tune.
-1. Create dynamic text and color size chooser (probably not everyone likes SystemFont_Small)
+1. Create dynamic text color and size chooser (probably not everyone likes SystemFont_Small)
2. Add filters by object name and type
-3. Add object deep copy option
-4. Add predefined buttons for every WoW API (just like _G)
-5. Add row delimiters so we can resize rows in table
-6. Add function args info and description from mapping file
+
+Not important:
+* Add predefined buttons for every WoW API (just like _G)
+* Add function args info and description from mapping file
+* Add object deep copy option
### How to contribute
For now this addon will be updated only when i need certain feature in my other addon's development
diff --git a/ViragDevTool.lua b/ViragDevTool.lua
index f1f2121..380589c 100644
--- a/ViragDevTool.lua
+++ b/ViragDevTool.lua
@@ -1,6 +1,6 @@
-- just remove global reference so it is easy to read with my ide
-local pairs, tostring, type, print, string, getmetatable, table, pcall, unpack =
-pairs, tostring, type, print, string, getmetatable, table, pcall, unpack
+local pairs, tostring, type, print, string, getmetatable, table, pcall, unpack, tonumber =
+pairs, tostring, type, print, string, getmetatable, table, pcall, unpack, tonumber
local HybridScrollFrame_CreateButtons, HybridScrollFrame_GetOffset, HybridScrollFrame_Update =
HybridScrollFrame_CreateButtons, HybridScrollFrame_GetOffset, HybridScrollFrame_Update
@@ -96,7 +96,9 @@ ViragDevTool = {
ViragDevTool:StartLogFunctionCalls(msg2, msg3)
end,
VDT_RESET_WND = function(msg2, msg3)
- ViragDevToolFrame:ClearAllPoints() ViragDevToolFrame:SetPoint("CENTER", UIParent)
+ ViragDevToolFrame:ClearAllPoints()
+ ViragDevToolFrame:SetPoint("CENTER", UIParent)
+ ViragDevToolFrame:SetSize(600, 200)
end
},
@@ -379,8 +381,6 @@ function ViragDevTool:ClearData()
self:UpdateMainTableUI()
end
-
-
function ViragDevTool:ExpandCell(info)
local nodeList = {}
@@ -531,7 +531,6 @@ function ViragDevTool:UpdateMainTableUI(force)
scrollFrame.scrollChild:SetWidth(scrollFrame:GetWidth())
end
-
function ViragDevTool:UpdateMainTableUIOptimized()
if (self.waitFrame == nil) then
@@ -564,25 +563,59 @@ function ViragDevTool:ScrollBar_AddChildren(scrollFrame, strTemplate)
end
end
+-- i ddo manual resizing and not the defalt
+-- self:GetParent():StartSizing("BOTTOMRIGHT");
+-- self:GetParent():StopMovingOrSizing();
+-- BEACUSE i don't like default behaviur.
+function ViragDevTool:ResizeMainFrame(dragFrame)
+ local parentFrame = dragFrame:GetParent()
+
+ local left = dragFrame:GetParent():GetLeft()
+ local top = dragFrame:GetParent():GetTop()
+
+ local x, y = GetCursorPosition()
+ local s = parentFrame:GetEffectiveScale()
+ x = x / s
+ y = y / s
+
+ local maxX, maxY = parentFrame:GetMaxResize()
+ local minX, minY = parentFrame:GetMinResize()
+
+ parentFrame:SetSize(self:CalculatePosition(x - left, minX, maxX),
+ self:CalculatePosition(top - y, minY, maxY))
+end
+
function ViragDevTool:DragResizeColumn(dragFrame, ignoreMousePosition)
local parentFrame = dragFrame:GetParent()
- local offset = parentFrame:GetLeft()
- local pos = dragFrame:GetLeft() - offset
+
+ -- 150 and 50 are just const values. safe to change
local minX = 150
local maxX = parentFrame:GetWidth() - 50
- if pos < minX then pos = minX end
- if pos > maxX then pos = maxX end
+
+ local pos = dragFrame:GetLeft() - parentFrame:GetLeft()
+ pos = self:CalculatePosition(pos, minX, maxX)
+
if not ignoreMousePosition then
local x, y = GetCursorPosition()
- x = x / parentFrame:GetEffectiveScale()
- if x <= (minX + offset) then pos = minX end
- if x >= (maxX + offset) then pos = maxX end
+ local s = parentFrame:GetEffectiveScale()
+ x = x / s
+ y = y / s
+ if x <= (minX + parentFrame:GetLeft()) then pos = minX end
+ if x >= (maxX + parentFrame:GetLeft()) then pos = maxX end
end
dragFrame:ClearAllPoints()
+ dragFrame:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", pos, -30) -- 30 is offset from above (top buttons)
+
+ -- save pos so we can restore it on reloda ui or logout
self.settings.collResizerPosition = pos
- dragFrame:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", pos, -30)
+end
+
+function ViragDevTool:CalculatePosition(pos, min, max)
+ if pos < min then pos = min end
+ if pos > max then pos = max end
+ return pos
end
function ViragDevTool:UIUpdateMainTableButton(node, info, id)
@@ -634,7 +667,7 @@ function ViragDevTool:UIUpdateMainTableButton(node, info, id)
end
nameButton:GetFontString():SetTextColor(unpack(color))
- -- typeButton:GetFontString():SetTextColor(unpack(color))
+ -- typeButton:GetFontString():SetTextColor(unpack(color))
valueButton:GetFontString():SetTextColor(unpack(color))
rowNumberButton:GetFontString():SetTextColor(unpack(color))
@@ -682,7 +715,6 @@ function ViragDevTool:EnableSideBarTab(tabStrName)
self:UpdateSideBarUI()
end
-
function ViragDevTool:UpdateSideBarUI()
local scrollFrame = self.wndRef.sideFrame.sideScrollFrame
@@ -804,9 +836,6 @@ function ViragDevTool:TryCallFunction(info)
end
end
-
-
-
-- lets try safe call first
local ok, results = self:TryCallFunctionWithArgs(fn, args)
@@ -1161,7 +1190,6 @@ function ViragDevTool:ToggleFnLogger(info)
end
end
-
function ViragDevTool:GetOldFn(tParent, fnName, oldFn)
if self.tempOldFns and
self.tempOldFns[tParent] and
diff --git a/ViragDevTool.xml b/ViragDevTool.xml
index 6c3e03f..c61782b 100644
--- a/ViragDevTool.xml
+++ b/ViragDevTool.xml
@@ -344,13 +344,16 @@
self:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
+
self:SetButtonState("PUSHED", true);
self:GetHighlightTexture():Hide();
- self:GetParent():StartSizing("BOTTOMRIGHT");
+
self.drag = true
+
</OnDragStart>
<OnUpdate>
if self.drag then
+ ViragDevTool:ResizeMainFrame(self)
ViragDevTool:DragResizeColumn(self:GetParent().columnResizer, true)
ViragDevTool:UpdateMainTableUI()
ViragDevTool:UpdateSideBarUI()
@@ -361,7 +364,7 @@
local parent = self:GetParent()
self:SetButtonState("NORMAL", false);
self:GetHighlightTexture():Show();
- parent:StopMovingOrSizing();
+ ViragDevTool:ResizeMainFrame(self)
ViragDevTool:DragResizeColumn(parent.columnResizer, true)
ViragDevTool:UpdateMainTableUI()
ViragDevTool:UpdateSideBarUI()
@@ -509,6 +512,7 @@
self:EnableMouse(true)
</OnEnter>
<OnDragStart>
+ self:SetButtonState("PUSHED", false);
self.isMoving = true
self:StartMoving()
</OnDragStart>
@@ -520,12 +524,14 @@
</OnUpdate>
<OnDragStop>
+ self:SetButtonState("NORMAL", false);
self:StopMovingOrSizing();
ViragDevTool:DragResizeColumn(self)
self.isMoving = false
</OnDragStop>
</Scripts>
+
<NormalTexture>
<Anchors>
<Anchor point="TOPRIGHT" x="-6"/>
@@ -534,13 +540,22 @@
<Color r="0" g="0.5" b="0" a="0.7"/>
</NormalTexture>
- <HighlightTexture>
+ <HighlightTexture alphaMode="ADD">
<Anchors>
- <Anchor point="TOPRIGHT"/>
- <Anchor point="BOTTOMLEFT"/>
+ <Anchor point="TOPRIGHT" x="-4"/>
+ <Anchor point="BOTTOMLEFT" x="4" y="0"/>
</Anchors>
- <Color r="0.1" g="0.5" b="0" a="0.7"/>
+ <Color r="0" g="0.3" b="0" a="0.8"/>
+
</HighlightTexture>
+ <PushedTexture alphaMode="ADD">
+ <Anchors>
+ <Anchor point="TOPRIGHT" x="-4"/>
+ <Anchor point="BOTTOMLEFT" x="4" y="0"/>
+ </Anchors>
+ <Color r="0" g="0.3" b="0" a="0.8"/>
+
+ </PushedTexture>
</Button>
<!--*********************************************************************************************************