Cell - Unit Frames

Cell - Unit Frames

148k Downloads

[Feature] Anchor unitframes to other any other frame

Reqlay opened this issue ยท 8 comments

commented

Describe the feature

I'd like to anchor my player and target frames specifically to for example Atrocitys weakaura unitframe position controllers generated frame to move the unitframes dynamically depending on the width of the invisible position controllers frame. Pretty niche feature but would love to see something like it implemented since none of the weakauras that are made for this work correctly.
Or if just anchoring to a weakaura is possible that would work great aswell.

Describe the implementation

Using a fstack or weakauras styled selector for a frame and/or just typing the exact frame to anchor the specified unitframe to. Would be great to be able specify the anchors of the unitframe and to what part of the other frame to anchor to with X and Y offsets.

commented

Once I got get up on my chars I'll put in some helper functions for what youre trying to do

commented

Is this something that another Unit Frame addon has implemented?
Can think of a couple of ways this could be implemented but would like to see other implementations if possible.

commented

I'd love to tell more specifics if need be if you consider implementing it.

commented

Not that I know of, I can provide the weakauras I've been working with trying to get this to work without ElvUI if you'd like. The weakauras we're implemented to work with ElvUI mainly.

commented

Yea if you could share those would be helpful

commented

AtrocityUIs ElvUI Position Controller: https://wago.io/pFOwuzP0P
Just looks up the width of a weakaura group from a pattern to assign the size of the frame which it anchors unitframes.

Anchor Controller: https://wago.io/m1marWVpo/
Assigns anchoring of frames to other frames with offsets.

Was using them separately to try setting dynamic and static unitframe moving depending on spec.
Mainly ran into problems with these when trying to have healer/aug profile unitframes static instead of dynamic like others.
Hope these help somewhat.

commented

Is this something that another Unit Frame addon has implemented? Can think of a couple of ways this could be implemented but would like to see other implementations if possible.

I'm trying to do the same as Reqlay as I have before with anchoring to other addons. I've mainly used Shadowed Unit Frames in the past to do it and that addon uses
SUFUnitplayer
SUFUnittarget

Currently trying to do it with Cell Unitframes via
CUF_Player
CUF_Target

CUF_Player anchors correctly but CUF_Target does not as it moves onto the position of CUF_Player.

Both CUF_% and SUFUnit% were pulled via /fstack.

Taken from the Shadowed Unitframes "config.lua"

-- Helper functions
local function getPageDescription(info)
	return PAGE_DESC[info[#(info)]]
end

local function getFrameName(unit)
	if( unit == "raidpet" or unit == "raid" or unit == "party" or unit == "maintank" or unit == "mainassist" or unit == "boss" or unit == "arena" ) then
		return string.format("#SUFHeader%s", unit)
	end

	return string.format("#SUFUnit%s", unit)
end

local anchorList = {}
local function getAnchorParents(info)
	local unit = info[2]
	for k in pairs(anchorList) do anchorList[k] = nil end

	if( ShadowUF.Units.childUnits[unit] ) then
		anchorList["$parent"] = string.format(L["%s member"], L.units[ShadowUF.Units.childUnits[unit]])
		return anchorList
	end

	anchorList["UIParent"] = L["Screen"]

	-- Don't let a frame anchor to a frame thats anchored to it already (Stop infinite loops-o-doom)
	local currentName = getFrameName(unit)
	for _, unitID in pairs(ShadowUF.unitList) do
		if( unitID ~= unit and ShadowUF.db.profile.positions[unitID] and ShadowUF.db.profile.positions[unitID].anchorTo ~= currentName ) then
			anchorList[getFrameName(unitID)] = string.format(L["%s frames"], L.units[unitID] or unitID)
		end
	end

	return anchorList
end
commented

@Reqlay @Xozat
I have added some API functions that you can use for custom positioning/sizing. Let me know if it needs some tweaking.

Can take a look at it over here:
https://github.com/Krealle/Cell_UnitFrames/blob/master/API/CustomAnchors.lua