View Single Post
06-08-17, 04:11 AM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Having an issue with edge of backdrop being disappeared when frame's size changes

Hi all,

I should have gone to 'Graphics Help' forum rather than here, 'Lua/XML Help', but I guess this is more like a Lua related issue.

So, I've created a generic Template function for my frames like the following:

Lua Code:
  1. function CustomFunc:SetTemplate(whatType, anchor)
  2.     local anchor = anchor or self;
  3.     local backdrop = LSM:Fetch("background", "backdrop");
  4.     local fer12 = LSM:Fetch("border", "fer12");
  5.  
  6.     local template = CreateFrame("Frame", anchor:GetName() .. "Template", self);
  7.     template:SetFrameLevel(self:GetFrameLevel());
  8.  
  9.     if whatType == 1 then -- Extend
  10.         template:SetPoint("TOPLEFT", anchor, "TOPLEFT", -1, 1);
  11.         template:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 1, -1);
  12.     elseif whatType == 2 then -- Shrink
  13.         template:SetPoint("TOPLEFT", anchor, "TOPLEFT", 1, -1);
  14.         template:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", -1, 1);
  15.     else -- Default
  16.         template:SetAllPoints(anchor);
  17.     end
  18.  
  19.     template:SetBackdrop({
  20.         bgFile = backdrop,
  21.         edgeFile = fer12,
  22.         edgeSize = 2,
  23.     });
  24.     template:SetBackdropColor(0.1, 0.1, 0.1);
  25.     template:SetBackdropBorderColor(0.7, 0.7, 0.7);
  26.  
  27.     anchor.template = template;
  28. end

Then I applied this to frame and resized the that frame.

Lua Code:
  1. bar = CreateFrame("StatusBar", "TestBar", UIParent);
  2. bar:SetPoint("CENTER");
  3. bar:SetSize(46, 10);
  4. bar:SetTemplate(1);
  5.  
  6. bar:SetWidth(55); -- Modify width

Since the template frame's size varies based on its anchor points, I thought this would work fine, but as you can see the image below, left & right borders are gone once I changed the width of parent frame, bar.
(Well, they are definitely there, but is not rendered(?) properly)



I also attempted to change those regions' draw layer, but that didn't solve the problem

Could anyone please help me out regarding this?

Thank you!

*EDIT: Applying insets to backdrop didn't do the trick as well.

Code:
insets = {
	left = 1,
	right = 1,
	top = 1,
	bottom = 1,
},

**EDIT: Here I've attached those texture files!
Attached Files
File Type: tga fer12.tga (8.0 KB, 130 views)
File Type: blp backdrop.BLP (1.3 KB, 139 views)

Last edited by Layback_ : 06-08-17 at 04:19 AM.
  Reply With Quote