WoWInterface SVN PetListPlus

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 7 to Rev 8
    Reverse comparison

Rev 7 → Rev 8

Main.lua
12,6 → 12,13
}
self.currentModel = 0
 
self.mouseTracking = {
["x"] = 0,
["y"] = 0,
["isMoving"] = false,
["isPanning"] = false,
}
 
self:RegisterEvent("ADDON_LOADED")
 
self:SetScript("OnEvent", function(...) self:OnEvent(...) end)
50,6 → 57,15
self.model:SetHeight(110)
self.model:SetPoint("TOPLEFT", 24, -75)
 
self.mouseframe = CreateFrame("Frame", nil, self)
self.mouseframe:SetAllPoints(self.model)
self.mouseframe:EnableMouseWheel(true)
self.mouseframe:EnableMouse(true)
self.mouseframe:SetScript("OnMouseDown", self.TrackingMouseDown)
self.mouseframe:SetScript("OnMouseUp", self.TrackingMouseUp)
self.mouseframe:SetScript("OnMouseWheel", self.TrackingMouseWheel)
self.mouseframe:SetScript("OnUpdate", self.TrackingUpdate)
 
local modelBG = self.model:CreateTexture(nil, "BACKGROUND")
modelBG:SetAllPoints(self.model)
modelBG:SetTexture("Interface\\PetPaperDollFrame\\UI-PetFrame-Frame")
139,6 → 155,8
self.buttons[count]:SetChecked(1)
if creatureID ~= self.currentModel then --So the model wont update every scroll change, making it twitch
self.model:SetCreature(creatureID)
self.model:SetPosition(0,0,0)
self.model:SetFacing(0)
self.currentModel = creatureID
end
else
208,3 → 226,53
 
PickupCompanion(mode, button:GetID())
end
 
-----------------------------------------------------------------------
--Tracking Mouse stuff
-----------------------------------------------------------------------
function self:TrackingMouseUp()
self = PetListPlus
local click = arg1
if click == "LeftButton" then
self.mouseTracking.isMoving = false
elseif click == "RightButton" then
self.mouseTracking.isPanning = false
end
end
 
function self:TrackingMouseDown()
self = PetListPlus
local click = arg1
if click == "LeftButton" then
self.mouseTracking.isMoving = true
self.mouseTracking.x, self.mouseTracking.y = GetCursorPosition()
elseif click == "RightButton" then
self.mouseTracking.isPanning = true
self.mouseTracking.x, self.mouseTracking.y = GetCursorPosition()
end
end
 
function self:TrackingMouseWheel()
self = PetListPlus
local value = arg1
local z, x, y = self.model:GetPosition();
local z = z + (0.5 * value)
self.model:SetPosition(z, x, y);
end
 
function self:TrackingUpdate()
self = PetListPlus
local mouseX, mouseY = GetCursorPosition()
 
if self.mouseTracking.isMoving then
self.model:SetFacing(self.model:GetFacing() + ((mouseX - self.mouseTracking.x)/30))
end
if self.mouseTracking.isPanning then
local z, x, y = self.model:GetPosition()
x = x + ((mouseX - self.mouseTracking.x)/50)
y = y + ((mouseY - self.mouseTracking.y)/50)
self.model:SetPosition(z, x, y)
end
 
self.mouseTracking.x, self.mouseTracking.y = GetCursorPosition()
end