Quantcast
Snapping Frames vertically horizontally - WoWInterface
Thread Tools Display Modes
05-11-21, 07:00 PM   #1
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 139
Snapping Frames vertically horizontally

Hi all

I am trying to find a way to snap multiple frames to each other.
I would like to snap these bars to any point; top to bottom, right to left and any combination thereof.
I have not been able to find any tutorials that help.

If someone here could direct me to a tutorial that would be fantastic.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
05-11-21, 09:08 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,641
It sounds like you are talking about what we have as anchoring functionality. You anchor the "TOP" of a frame to the "BOTTOM" of another frame to get them connected vertically. Similarly "LEFT" to "RIGHT" for horizontal connections. "CENTER" to "CENTER" will anchor the center of frame1 to the center of frame2.

https://wowpedia.fandom.com/wiki/Anchors
https://wowpedia.fandom.com/wiki/API_Region_SetPoint

Hopefully those above will help you see whats possible.

Also, https://www.townlong-yak.com/framexml/live has the latest Blizzard code you can look at to see how some of the frames do it that you want to emulate.

But, based on your addon list I suspect it is more than what can be done via this that you are talking about. Maybe a visual example or a more verbal example of what you are looking for. But, you should be able to use a multiple of simple connections but you will need to have some sort of hierarchy to the frames for it to work well together.
__________________

Last edited by Xrystal : 05-11-21 at 09:10 PM.
  Reply With Quote
05-12-21, 01:51 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,846
Have a look at Tuller's LibFlyPaper. This is what is used in Dominos, for example.
https://github.com/Tuller/FlyPaper
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
05-13-21, 07:15 PM   #4
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 139
Hi all

Sorry for the delayed response.

I have 4 separate frames A, B, C and D.

I want to have each frame to be able to move freely, however, when a frame touches another frame I want them to snap together either top to bottom or left to right.

I want to be able to snap in any combination, eg.



I still do not know how to use libraries but will use the link to see if I can nut it out.

Cheers
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
05-14-21, 11:19 AM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,846
Using a library will likely be your best bet, as what you are attempting can get quite complicated.

Besides looking at how Dominos uses LibFlyPaper, you can also look at StatBlock - it uses the library, too.
https://www.wowinterface.com/downloa...reDisplay.html
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
05-18-21, 07:05 PM   #6
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 139
Hi Seerah

Wow, I have been really bad at replying within a reasonable time frame of late, sorry for that.

I am still unsure how to use libraries or even two or more .lua files in one project.

I have not yet been able to nut out namespaces, I will just join the discord as I will have many many noob questions that would flood this post.

Once again thanks for the help, you guys are always so helpful.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
05-19-21, 12:53 AM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,641
I use minimal libraries myself but I do have multiple files in my addons.

If you put this line ( or similar ) at the top of each file they will have access to your addon wide table or namespace.

local addonName, addonTable = ...
This fills the variable addonName with the name of the addon in question and fills the variable addonTable with the data currently available to the addon.

For example: If I were to have an addon called Portals I could use the following:
local Portals, PortalsNS = ...

And then use local for variables and functions only used in that file, public for variables and functions you want other addons to access and PortalsNS[key] = function(...) end and PortalsNS[key] = value and PortalsNS[key] = { .. } and PortalsNS.variableName = value etc for data you want the rest of your addon to have access to.

Just make sure that the files are processed in the right order so that the relevant data is available when needed.
__________________
  Reply With Quote
05-25-21, 09:17 PM   #8
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 139
Heya Xrystal

Thanks for the advice, I will be playing with namespaces and will absolutely be using your example.

Thanks for the help.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Snapping Frames vertically horizontally

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off