View Single Post
10-28-14, 09:24 AM   #1
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation Quest Frame move issue

I am able to move the quest frame, however the semi-transparent background box's upper right corner is locked in position and moving the quest frame simply stretches the background box across my screen.
Code:
local questHeight		= 1
local questScale		= 0.8

ObjectiveTrackerFrame:ClearAllPoints()
ObjectiveTrackerFrame:SetPoint('TOPRIGHT', Minimap, 'BOTTOMRIGHT', 0, -16)
ObjectiveTrackerFrame:SetHeight((ObjectiveTrackerFrame:GetTop() - CONTAINER_OFFSET_Y) * GetPercent(questHeight))
ObjectiveTrackerFrame:SetScale(GetPercent(questScale))
ObjectiveTrackerFrame:SetClampedToScreen(false)
MY move code
Code:
local silhouette, movers = UIParent:CreateTexture(nil, 'BACKGROUND')
silhouette:SetTexture([[Interface\BUTTONS\WHITE8X8]])
silhouette:SetAlpha(0.45)
silhouette:Hide()

local function GetRelativePoint(frame)
	local L1, B1, W1, H1 = UIParent:GetRect()
	local L2, B2, W2, H2 = frame:GetRect()
	local x, y, h, w, anchor = L2 - L1, B2 - B1, H1 - H2, W1 - W2
	if x < w * 0.5 then
		anchor = 'LEFT'
	else
		anchor, x = 'RIGHT', x - w
	end
	if y < h * 0.5 then
		anchor = 'BOTTOM' .. anchor
	else
		anchor, y = 'TOP' .. anchor, y - h
	end
	return anchor, x, y
end

local function OnMouseDown(self, button)
	if button ~= 'LeftButton' then return end
	self.moving = true
	if not self[4]:IsVisible() or self[5] then
		silhouette:SetParent(self)
		silhouette:ClearAllPoints()
		silhouette:SetAllPoints(self[4])
		silhouette:Show()
	end
	self:StartMoving()
end

local function OnMouseUp(self, button)
	if button ~= 'LeftButton' or not self.moving then return end
	self.moving = nil
	silhouette:Hide()
	self:StopMovingOrSizing()
end

local function CreateMoverFrame(name, moveFrame, silhouette)
	local frame = CreateFrame('Frame', addonName .. name .. "Mover", UIParent)
	frame:EnableMouse(true)
	frame:SetMovable(true)
	frame:SetClampedToScreen(true)
	frame:SetScript('OnMouseDown', OnMouseDown)
	frame:SetScript('OnMouseUp', OnMouseUp)
	frame:Hide()

	local texture = frame:CreateTexture(nil, 'BORDER')
	texture:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
	texture:SetAllPoints()
	texture:SetTexCoord(0, 0.625, 0, 0.6875)

	local string = frame:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
	string:SetPoint('CENTER', 1, 0)
	string:SetText(name)
	frame:SetHeight(string:GetStringHeight() + 8)
	frame:SetWidth(string:GetStringWidth() + 16)

	frame:SetPoint('TOP', moveFrame)
	local anchor, x, y = GetRelativePoint(frame)
	frame:ClearAllPoints()
	frame:SetPoint(anchor, x, y)

	moveFrame:ClearAllPoints()
	moveFrame:SetPoint('TOP', frame)
	moveFrame.ClearAllPoints = DoNothing
	moveFrame.SetAllPoints = DoNothing
	moveFrame.SetPoint = DoNothing

	frame[1], frame[2], frame[3], frame[4], frame[5], frame[6] = anchor, x, y, silhouette or moveFrame, silhouette == false or nil
	return frame
end

movers = {
	CreateMoverFrame("Minimap", Minimap, MinimapBorder),
	CreateMoverFrame("Quest", ObjectiveTrackerFrame, false),
	CreateMoverFrame("Ticket", TicketStatusFrame),
	CreateMoverFrame("Vehicle", VehicleSeatIndicator),
        CreateMoverFrame("WorldState", WorldStateAlwaysUpFrame),
}
My commands
Code:
_G['SLASH_' .. addonName .. 1] = strlower("/wmp")
SlashCmdList[addonName] = function(msg)
	msg = msg:lower()
	if msg == "lock" then
		for index = 1, #movers do
			movers[index]:Hide()
		end
	elseif msg == "mouse" then
		print("|cff3399ffw|rMmap mouse button assignments:")
		print("|cff1eff1eleft|r - Ping the minimap")
		print("|cff1eff1emiddle|r - Toggle the calendar")
		print("|cff1eff1eright|r - Toggle the tracking menu")
		print("|cff1eff1ewheel|r - Zoom the minimap in/out")
	elseif msg == "reset" then
		local frame
		for index = 1, #movers do
			frame = movers[index]
			frame:ClearAllPoints()
			frame:SetPoint(frame[1], frame[2], frame[3])
		end
	elseif msg == "rl" then
		ReloadUI()
	elseif msg == "cl" then
		ToggleCalendar()
	elseif msg == "unlock" then
		for index = 1, #movers do
			movers[index]:Show()
		end
	else
		print("|cff3399ffw|rMmap commands:")
		print("|cff1eff1elock|r - Hide frame movers to prevent dragging.")
		print("|cff1eff1emouse|r - Display mouse button assignments.")
		print("|cff1eff1ereset|r - Reset frames to their default positions.")
		print("|cff1eff1erl|r - Reload the UI.")
		print("|cff1eff1ecl|r - Toggle Calendar.")
		print("|cff1eff1eunlock|r - Show frame movers to enable dragging.")
	end
end
my map moves fine and everything else i can see, but when i move the quest frame i get that issue, i looked into added these few lines but still nothing.

Code:
 ObjectiveTrackerFrame:SetMovable(true)
 ObjectiveTrackerFrame:SetUserPlaced(true)
 ObjectiveTrackerFrame.ignoreFramePositionManager = true
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.