Resizing Frames
I've tried a bit of searching both here and Google, and only found a few examples. I'm trying to make JWXPBar and JWRepBar re-sizable. The frame moves regardless of which modifier I use. Here is my code (I've included the entire addon just in case :)). Lines 31-34 and 60-79 is the code related to resizing.
Lua Code:
Any help or pointers in the right direction is appreciated. |
What is your actual question? You said "the frame moves regardless of which modifier I use", but is that a description something your code does now that you don't want, or a description of something it doesn't do that you do want? Does anything related to moving/resizing work right now in your addon? If so, what works, and how is it different than what you want it to do?
|
Quote:
|
I'm not sure how that second part (frames drag when you use the right mouse button) can happen, given the code you posted:
Lua Code:
Try adding some print statements to clarify what's happening: Code:
JWRepBarFrame:SetScript("OnMouseDown", function(self, button)
Compare: Code:
JWRepBarFrame:SetScript("OnMouseDown", function(self, button) |
Actually after looking at the grand total of 3 objects in the default UI that are resizable using this method, I think the (main) problem is that you need to specify a direction in which to resize the frame, like:
Code:
object:StartSizing("BOTTOMRIGHT") If you want your frame to be resizable by any edge or corner, then you'll need to do some math to figure out which edge or corner to use based on the cursor location on mousedown. The other option would be to add additional "drag handle" buttons on top of your frame, each sized and placed appropriately, and call "object:GetParent():StartSizing(point)" in their mousedown handlers. You can see that technique in use in my chat addon (written so long ago I'd forgotten about it initially) here: https://github.com/phanx-wow/PhanxCh...esizeEdges.lua You could make them invisible, or have them only appear when the shift button was pressed (by registering for the MODIFIER_STATE_CHANGED event on your frame). |
Quote:
|
All times are GMT -6. The time now is 06:47 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI