WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   Scrollframes:SetPoint and clipping (https://www.wowinterface.com/forums/showthread.php?t=53872)

Infus 07-11-16 02:13 PM

Scrollframes:SetPoint and clipping
 
In this code a scrollframe is moved to a different position. Doing that naively, results in the clipping not correctly updating. Hiding the scrollframe before setting the new position and then reshowing updates the clipping.

That is, I would expect spinner1 and spinner2 to behave identically.

Code:

local function createFrame()
  local spinner = CreateFrame('Frame', nil, parent)
  spinner:SetSize(64, 64)

  -- ScrollFrame is the top right quadrant of spinner
  local scrollframe = CreateFrame('ScrollFrame', nil, spinner)
  scrollframe:SetPoint('BOTTOMLEFT', spinner, 'CENTER')
  scrollframe:SetPoint('TOPRIGHT')
  spinner.scrollframe = scrollframe

  local scrollchild = CreateFrame('frame', nil, scrollframe)
  scrollframe:SetScrollChild(scrollchild)
  scrollchild:SetAllPoints(scrollframe)

  -- Clipped by scrollframe
  local wedge = scrollchild:CreateTexture()
  wedge:SetAllPoints(spinner)
  spinner.wedge = wedge;

  return spinner;
end


local spinner1 = createFrame();
spinner1:SetPoint('BOTTOMRIGHT', UIParent, 'CENTER', -2, 2);
spinner1.wedge:SetTexture('interface/icons/inv_mushroom_11')

local spinner2 = createFrame();
spinner2:SetPoint('BOTTOMLEFT', UIParent, 'CENTER', 2, 2);
spinner2.wedge:SetTexture(236595)

C_Timer.After(3, function()
  -- Move the scroll frames to the top left quadrant
  spinner1.scrollframe:ClearAllPoints();
  spinner1.scrollframe:SetPoint('BOTTOMRIGHT', spinner1, 'CENTER');
  spinner1.scrollframe:SetPoint('TOPLEFT');

  spinner2.scrollframe:Hide();
  spinner2.scrollframe:ClearAllPoints();
  spinner2.scrollframe:SetPoint('BOTTOMRIGHT', spinner2, 'CENTER');
  spinner2.scrollframe:SetPoint('TOPLEFT');
  spinner2.scrollframe:Show();
end)


zork 07-12-16 02:25 AM

Interesting. Thanks for posting.


All times are GMT -6. The time now is 07:10 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI