oUF

97.2k Downloads

SafeZone support for vertical castbar orientation

LybrialsGit opened this issue ยท 3 comments

commented

Im currently using oUF in version 9.3.1

In this version you still support the vertical orientation for castbars, meaning the castbar statusbar and the castbar spark is working for horizontal and for vertical orientation.

However what is not working is the SafeZone. It will always act like the catbars orientation is horizontal. This is because of the following code:

sf:ClearAllPoints()
sf:SetPoint(element:GetReverseFill() and 'RIGHT' or 'LEFT')
sf:SetPoint('TOP')
sf:SetPoint('BOTTOM')
updateSafeZone(element) 

local function updateSafeZone(self)
	local safeZone = self.SafeZone
	local width = self:GetWidth()
	local _, _, _, ms = GetNetStats()

	local safeZoneRatio = (ms / 1e3) / self.max
	if(safeZoneRatio > 1) then
		safeZoneRatio = 1
	end

	safeZone:SetWidth(width * safeZoneRatio)
end

So you do not differentiate between vertical and horizontal orientation like you do for the spark for example.

In an older version of oUF you supported the orientation change for the SafeZone too:

	local safeZone = element.SafeZone
	if(safeZone) then
		local isHoriz = element:GetOrientation() == 'HORIZONTAL'

		safeZone:ClearAllPoints()
		safeZone:SetPoint(isHoriz and 'TOP' or 'LEFT')
		safeZone:SetPoint(isHoriz and 'BOTTOM' or 'RIGHT')

		if(element.casting) then
			safeZone:SetPoint(element:GetReverseFill() and (isHoriz and 'LEFT' or 'BOTTOM') or (isHoriz and 'RIGHT' or 'TOP'))
		else
			safeZone:SetPoint(element:GetReverseFill() and (isHoriz and 'RIGHT' or 'TOP') or (isHoriz and 'LEFT' or 'BOTTOM'))
		end

		local ratio = (select(4, GetNetStats()) / 1000) / element.max
		if(ratio > 1) then
			ratio = 1
		end

		safeZone[isHoriz and 'SetWidth' or 'SetHeight'](safeZone, element[isHoriz and 'GetWidth' or 'GetHeight'](element) * ratio)
	end

Is there a reason why you decided to no longer support this feature?

commented

My bad. Seems like there was never support for SafeZone orientation (I checked git history until 2 years back). So maybe the code was from someone else.

commented

There is no reason not to add the behaviour now :)

commented

@LybrialsGit could you please test #527 and see if it fixes it or I missed something.