View Single Post
08-08-19, 06:19 AM   #8
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Lybrial View Post
Lua Code:
  1. function LybrialAnchors:CreateVerticalLines(steps, widthStep)
  2.     for i = 0, steps do
  3.         local region = self.grid:CreateTexture();
  4.         region:SetColorTexture(0, 0, 0);
  5.         region:SetDrawLayer("BACKGROUND", 0);
  6.         region:ClearAllPoints();
  7.         region:SetPoint("TOPLEFT", self.grid, "TOPLEFT", (i * widthStep), 0);
  8.         region:SetPoint("BOTTOMRIGHT", self.grid, "BOTTOMLEFT", (i * widthStep), 0);
  9.     end
  10. end
You are creating new vertical lines each time that code is called. Currently they are all stacked on top of each other so you can't tell but if you change steps or widthStep you will be able to tell.

You need to reuse lines or create new ones as needed and hide the ones that are not in use if you end up with extras. You can see an example of this in GraphPaper (note: versions 1.4.10 and prior use CreateTexture as you are using here and version 1.4.11 uses the newer CreateLine).
  Reply With Quote