+ Reply to Thread
Results 1 to 1 of 1

Thread: GetFullHeight() need replacement

  1. #1
    Rift Chaser Ferather's Avatar
    Join Date
    Jun 2011
    Posts
    341

    Default GetFullHeight() need replacement

    Recently Trion for totally unknown and invalid reasons decided to remove GetFullHight and GetFullWidth

    This has totally broken my death log for super meter. Ive tried to unset the heights and work around it, So far nothing works

    Code:
    DeathLog = {}
    function DeathLog:new()
    	local o = {
    		state = {},
    		offsetY = 0,
    	}
    	setmetatable(o, self)
    	self.__index = self
    
    	local params = SuperMeter.UI.Settings
    
    	o.frame = UI.CreateFrame("Frame", "SuperMeter Interface", SuperMeter.UI.Context)
    	o.frame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", SuperMeter_logX, SuperMeter_logY)
    	o.frame:SetBackgroundColor(0, 0, 0, 0.6)
    	o.frame:SetVisible(false)
    	o.frame:SetHeight(244)
    	o.frame:SetWidth(526)
    
    	o.titleBG = SuperMeter.UI.CreateFrame({
    		type = "Frame", name = "Death Log Title Background", parent = o.frame,
    		r = 0, g = 0.4, b = 0.8, a = 0.4, height = 22, width = 526, layer = 2,
    		alignTarget = o.frame, alignTo = "TOPCENTER", align = "TOPCENTER", x = 0, y = 0,
    	})
    
    	o.title = SuperMeter.UI.CreateFrame({
    		type = "Text", name = "Death Log Title", parent = o.titleBG,
    		text = "Super Meter Player Death Log", fontSize = 16, layer = 4,
    		alignTarget = o.titleBG, alignTo = "TOPCENTER", align = "TOPCENTER", x = 0, y = -2.8,
    	})
    
    	o.logBG = SuperMeter.UI.CreateFrame({
    		type = "Frame", name = "Death Log Background ", parent = o.frame,
    		r = 0, g = 0.2, b = 0.4, a = 0.2, height = 222, width = 526, layer = 2,
    		alignTarget = o.frame, alignTo = "TOPCENTER", align = "TOPCENTER", x = 0, y = 22,
    	})
    
    	o.mask = SuperMeter.UI.CreateFrame({
    		type = "Mask", name = "Death Log Mask", parent = o.frame, 
    		height = 216, width = 526, layer = 4,
    		alignTarget = o.logBG, alignTo = "TOPCENTER", align = "TOPCENTER", x = 0, y = 0,
    	})
    
    	o.log = SuperMeter.UI.CreateFrame({
    		type = "Text", name = "Death Log", parent = o.mask,
    		text = "", wordwrap = true, width = 488,
    		fontR = 0.4, fontG = -0.2, fontB = 0.0, layer = 6,
    		alignTarget = o.logBG, alignTo = "TOPCENTER", align = "TOPCENTER", x = 12, y = 0,
    	})
    
    	o.bar = SuperMeter.UI.CreateFrame({
    		type = "RiftScrollbar", name = "Death Log Slider", parent = o.logBG,
    		height = 210, width = 16.8, layer = 6, hide = true,
    		alignTarget = o.logBG, alignTo = "TOPLEFT", align = "TOPLEFT", x = 8.8, y = 6,
    	})
    
    	function o.title.Event:MouseIn() self:SetFontColor(0.6, 0.6, 0.6) end
    	function o.title.Event:MouseOut() self:SetFontColor(1, 1, 1) end
    
    	function o.title.Event:LeftDown()
    		o.state.mouseDown = true
    		local mouse = Inspect.Mouse()
    		o.state.startX = o.frame:GetLeft()
    		o.state.startY = o.frame:GetTop()
    		o.state.mouseStartX = mouse.x
    		o.state.mouseStartY = mouse.y
    		o.frame:SetBackgroundColor(0.2, 0.2, 0.2, params.alpha)
    	end
    
    	function o.title.Event:MouseMove()
    		if o.state.mouseDown then
    			local mouse = Inspect.Mouse()
    			SuperMeter_logX = mouse.x - o.state.mouseStartX + o.state.startX
    			SuperMeter_logY = mouse.y - o.state.mouseStartY + o.state.startY
    			o.frame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", SuperMeter_logX, SuperMeter_logY)
    		end
    	end
    
    	function o.title.Event:LeftUp()
    		if o.state.mouseDown then
    			o.state.mouseDown = false
    			o.frame:SetBackgroundColor(0, 0, 0, 0.6)
    		end
    	end
    
    	function o.frame.Event:WheelBack()
    		if o.log:GetHeight() > 216 then
    			o.bar:NudgeDown()
    		end
    	end
    
    	function o.frame.Event:WheelForward()
    		if o.log:GetHeight() > 216 then
    			o.bar:NudgeUp()
    		end
    	end
    
    	function o.bar.Event:ScrollbarChange()
    		offsetY = o.bar:GetPosition() - o.bar:GetPosition() * 2
    		o.log:SetPoint("TOPCENTER", o.logBG, "TOPCENTER", 12, offsetY)
    	end
    
    	return o
    end
    
    function DeathLog:Show(text)
    	self.log:SetText(text)
    	local Height = 216
    	local FullHeight = self.log:GetHeight()
    
    	if Height < FullHeight then
    		self.log:SetHeight(FullHeight)
    		self.bar:SetRange(0, FullHeight - 216)
    		self.bar:SetVisible(true)
    		self.bar:Nudge(FullHeight)
    	end
    	if Height > FullHeight then
    		self.bar:SetVisible(false)
    		self.log:SetPoint("TOPCENTER", self.logBG, "TOPCENTER", 12, 0)
    	end
    end
    
    function DeathLog:Toggle()
    	local SuperMeter_logVisable = nil
    	if SuperMeter_logVisable == true then SuperMeter_logVisable = false end
    	if SuperMeter_logVisable == false then SuperMeter_logVisable = true end
    	self.frame:SetVisible(not self.frame:GetVisible())
    end
    
    function DeathLog:Reset()
    	self.frame:SetVisible(false)
    	self.frame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", SuperMeter_logX, SuperMeter_logY)
    	self.log:SetPoint("TOPCENTER", self.logBG, "TOPCENTER", 12, 0)
    end
    This Part is the bit that no longer functions:

    Code:
    function DeathLog:Show(text)
    	self.log:SetText(text)
    	local Height = 216
    	local FullHeight = self.log:GetHeight()
    
    	if Height < FullHeight then
    		self.log:SetHeight(FullHeight)
    		self.bar:SetRange(0, FullHeight - 216)
    		self.bar:SetVisible(true)
    		self.bar:Nudge(FullHeight)
    	end
    	if Height > FullHeight then
    		self.bar:SetVisible(false)
    		self.log:SetPoint("TOPCENTER", self.logBG, "TOPCENTER", 12, 0)
    	end
    end
    Orginal Code:

    Code:
    function DeathLog:Show(text)
    	self.log:SetText(text)
    	local Height = self.log:GetHeight()
    	local FullHeight = self.log:GetFullHeight()
    
    	if Height < FullHeight then
    		self.log:SetHeight(FullHeight)
    		self.bar:SetRange(0, FullHeight - 216)
    		self.bar:SetVisible(true)
    		self.bar:Nudge(FullHeight)
    	end
    	if Height > FullHeight then
    		self.bar:SetVisible(false)
    		self.log:SetPoint("TOPCENTER", self.logBG, "TOPCENTER", 12, 0)
    	end
    end
    Last edited by Ferather; 09-13-2012 at 09:23 AM.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts