Quantcast
Scrollframes:SetPoint and clipping - WoWInterface
 
Thread Tools Display Modes
07-11-16, 02:13 PM   #1
Infus
A Deviate Faerie Dragon
Join Date: Jul 2016
Posts: 13
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)
 
07-12-16, 02:25 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
Interesting. Thanks for posting.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Scrollframes:SetPoint and clipping

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off