HelpTip.lua

HelpTip.lua (9.0.2.37474; unchanged since 9.0.2.36665)
  1. --[[
  2. infoTable = {
  3. text, -- also acts as a key for various API, MUST BE SET
  4. textColor = HIGHLIGHT_FONT_COLOR,
  5. textJustifyH = "LEFT",
  6. buttonStyle = HelpTip.ButtonStyle.None -- button to close the helptip, or no button at all
  7. targetPoint = HelpTip.Point.BottomEdgeCenter, -- where at the parent/relativeRegion the helptip should point
  8. alignment = HelpTip.Alignment.Center, -- alignment of the helptip relative to the parent/relativeRegion (basically where the arrow is located)
  9. hideArrow = false, -- whether to hide the arrow
  10. offsetX = 0,
  11. offsetY = 0,
  12. cvar, cvarValue, -- cvar to set when closed by user or from HelpTip:Acknowledge()
  13. cvarBitfield, bitfieldFlag, -- cvarbitfield to set when closed by user or from HelpTip:Acknowledge()
  14. onHideCallback, callbackArg, -- callback whenever the helptip is closed: onHideCallback(acknowledged, callbackArg)
  15. onAcknowledgeCallback -- callback whenever the helptip is closed by the user clicking its button: onAcknowledgeCallback(callbackArg)
  16. checkCVars = false, -- on: helptip will only be shown if the cvar or cvarBitfield is not set
  17. autoEdgeFlipping = false, -- on: will flip helptip to opposite edge based on relative region's center vs helptip's center during OnUpdate
  18. autoHorizontalSlide = false, -- on: will change the alignment to fit helptip on screen during OnUpdate
  19. useParentStrata = false, -- whether to use parent framestrata
  20. system = "" -- reference string
  21. systemPriority = 0, -- if a system and a priority is specified, higher priority helptips will close another helptip in that system
  22. extraRightMarginPadding = 0, -- extra padding on the right side of the helptip
  23. acknowledgeOnHide = false, -- whether to treat a hide as an acknowledge
  24. }
  25. ]]--
  26. HelpTip = { };
  27. -- external use enums
  28. HelpTip.Point = {
  29. TopEdgeLeft = 1,
  30. TopEdgeCenter = 2,
  31. TopEdgeRight = 3,
  32. BottomEdgeLeft = 4,
  33. BottomEdgeCenter = 5,
  34. BottomEdgeRight = 6,
  35. RightEdgeTop = 7,
  36. RightEdgeCenter = 8,
  37. RightEdgeBottom = 9,
  38. LeftEdgeTop = 10,
  39. LeftEdgeCenter = 11,
  40. LeftEdgeBottom = 12,
  41. };
  42. HelpTip.Alignment = {
  43. Left = 1,
  44. Center = 2,
  45. Right = 3,
  46. -- Intentional re-use of indices, really just need 3 settings but 5 makes it easier to visualize
  47. Top = 1,
  48. Bottom = 3,
  49. };
  50. HelpTip.ButtonStyle = {
  51. None = 1,
  52. Close = 2,
  53. Okay = 3,
  54. GotIt = 4,
  55. Next = 5,
  56. };
  57. -- internal use enums
  58. HelpTip.ArrowRotation = {
  59. Down = 1,
  60. Left = 2,
  61. Up = 3,
  62. Right = 4,
  63. };
  64. -- data
  65. HelpTip.PointInfo = {
  66. [HelpTip.Point.TopEdgeLeft] = { arrowRotation = HelpTip.ArrowRotation.Down, relativeAnchor = "TOPLEFT", oppositePoint = HelpTip.Point.BottomEdgeLeft },
  67. [HelpTip.Point.TopEdgeCenter] = { arrowRotation = HelpTip.ArrowRotation.Down, relativeAnchor = "TOP", oppositePoint = HelpTip.Point.BottomEdgeCenter },
  68. [HelpTip.Point.TopEdgeRight] = { arrowRotation = HelpTip.ArrowRotation.Down, relativeAnchor = "TOPRIGHT", oppositePoint = HelpTip.Point.BottomEdgeRight },
  69. [HelpTip.Point.RightEdgeTop] = { arrowRotation = HelpTip.ArrowRotation.Left, relativeAnchor = "TOPRIGHT", oppositePoint = HelpTip.Point.LeftEdgeTop },
  70. [HelpTip.Point.RightEdgeCenter] = { arrowRotation = HelpTip.ArrowRotation.Left, relativeAnchor = "RIGHT", oppositePoint = HelpTip.Point.LeftEdgeCenter },
  71. [HelpTip.Point.RightEdgeBottom] = { arrowRotation = HelpTip.ArrowRotation.Left, relativeAnchor = "BOTTOMRIGHT",oppositePoint = HelpTip.Point.LeftEdgeBottom },
  72. [HelpTip.Point.BottomEdgeRight] = { arrowRotation = HelpTip.ArrowRotation.Up, relativeAnchor = "BOTTOMRIGHT",oppositePoint = HelpTip.Point.TopEdgeRight },
  73. [HelpTip.Point.BottomEdgeCenter]= { arrowRotation = HelpTip.ArrowRotation.Up, relativeAnchor = "BOTTOM", oppositePoint = HelpTip.Point.TopEdgeCenter },
  74. [HelpTip.Point.BottomEdgeLeft] = { arrowRotation = HelpTip.ArrowRotation.Up, relativeAnchor = "BOTTOMLEFT", oppositePoint = HelpTip.Point.TopEdgeLeft },
  75. [HelpTip.Point.LeftEdgeBottom] = { arrowRotation = HelpTip.ArrowRotation.Right, relativeAnchor = "BOTTOMLEFT", oppositePoint = HelpTip.Point.RightEdgeBottom },
  76. [HelpTip.Point.LeftEdgeCenter] = { arrowRotation = HelpTip.ArrowRotation.Right, relativeAnchor = "LEFT", oppositePoint = HelpTip.Point.RightEdgeCenter },
  77. [HelpTip.Point.LeftEdgeTop] = { arrowRotation = HelpTip.ArrowRotation.Right, relativeAnchor = "TOPLEFT", oppositePoint = HelpTip.Point.RightEdgeTop },
  78. };
  79. HelpTip.ArrowOffsets = {
  80. [HelpTip.Alignment.Center] = { 0, 5 };
  81. [HelpTip.Alignment.Left] = { 35, 5 };
  82. [HelpTip.Alignment.Right] = { -35, 5 };
  83. };
  84. HelpTip.ArrowGlowOffsets = { 0, 4 };
  85. HelpTip.DistanceOffsets = {
  86. [HelpTip.Alignment.Center] = { 0, -20 };
  87. [HelpTip.Alignment.Left] = { -35, -20 };
  88. [HelpTip.Alignment.Right] = { 35, -20 };
  89. };
  90. HelpTip.Rotations = {
  91. [HelpTip.ArrowRotation.Down] = { modOffsetX = 1, modOffsetY = -1, swapOffsets = false, degrees = 0, anchors = { "BOTTOMLEFT", "BOTTOM", "BOTTOMRIGHT" } },
  92. [HelpTip.ArrowRotation.Left] = { modOffsetX = -1, modOffsetY = -1, swapOffsets = true, degrees = 90, anchors = { "TOPLEFT", "LEFT", "BOTTOMLEFT" } },
  93. [HelpTip.ArrowRotation.Up] = { modOffsetX = 1, modOffsetY = 1, swapOffsets = false, degrees = 180, anchors = { "TOPLEFT", "TOP", "TOPRIGHT"} },
  94. [HelpTip.ArrowRotation.Right] = { modOffsetX = 1, modOffsetY = -1, swapOffsets = true, degrees = 270, anchors = { "TOPRIGHT", "RIGHT", "BOTTOMRIGHT" } },
  95. };
  96. HelpTip.Buttons = {
  97. [HelpTip.ButtonStyle.None] = { textWidthAdj = 0, heightAdj = 0, parentKey = nil },
  98. [HelpTip.ButtonStyle.Close] = { textWidthAdj = -6, heightAdj = 0, parentKey = "CloseButton" },
  99. [HelpTip.ButtonStyle.Okay] = { textWidthAdj = 0, heightAdj = 30, parentKey = "OkayButton", text = OKAY },
  100. [HelpTip.ButtonStyle.GotIt] = { textWidthAdj = 0, heightAdj = 30, parentKey = "OkayButton", text = HELP_TIP_BUTTON_GOT_IT },
  101. [HelpTip.ButtonStyle.Next] = { textWidthAdj = 0, heightAdj = 30, parentKey = "OkayButton", text = NEXT },
  102. };
  103. HelpTip.verticalPadding = 31;
  104. HelpTip.minimumHeight = 72;
  105. HelpTip.defaultTextWidth = 196;
  106. HelpTip.width = 226;
  107. HelpTip.halfWidth = HelpTip.width / 2;
  108. HelpTip.supressHelpTips = {};
  109. do
  110. local function HelpTipReset(framePool, frame)
  111. frame:ClearAllPoints();
  112. frame:Hide();
  113. frame:Reset();
  114. end
  115. HelpTip.framePool = CreateFramePool("FRAME", nil, "HelpTipTemplate", HelpTipReset);
  116. end
  117. function HelpTip:SetHelpTipsEnabled(flag, enabled)
  118. HelpTip.supressHelpTips[flag] = enabled or false;
  119. end
  120. function HelpTip:AreHelpTipsEnabled()
  121. for flagType, flagValue in pairs(self.supressHelpTips) do
  122. if not flagValue then
  123. return false;
  124. end
  125. end
  126. return true;
  127. end
  128. function HelpTip:Show(parent, info, relativeRegion)
  129. assert(info and info.text, "Invalid helptip info");
  130. assert((info.bitfieldFlag ~= nil and info.cvarBitfield ~= nil) or (info.bitfieldFlag == nil and info.cvarBitfield == nil));
  131. if not self:CanShow(info) then
  132. return false;
  133. end
  134. if self:IsShowing(parent, info.text) then
  135. return true;
  136. end
  137. local frame = self.framePool:Acquire();
  138. frame.width = HelpTip.width + (info.extraRightMarginPadding or 0);
  139. frame:SetWidth(frame.width);
  140. frame:Init(parent, info, relativeRegion or parent);
  141. frame:Show();
  142. return true;
  143. end
  144. function HelpTip:CanShow(info)
  145. if Kiosk.IsEnabled() then
  146. return false;
  147. end
  148. if not self:AreHelpTipsEnabled() then
  149. return false;
  150. end
  151. if info.checkCVars then
  152. if info.cvar then
  153. if GetCVar(info.cvar) ~= info.cvarValue then
  154. return false;
  155. end
  156. end
  157. if info.cvarBitfield then
  158. if GetCVarBitfield(info.cvarBitfield, info.bitfieldFlag) then
  159. return false;
  160. end
  161. end
  162. end
  163. -- priority
  164. if info.system and info.systemPriority then
  165. for frame in self.framePool:EnumerateActive() do
  166. if frame.info.system == info.system and frame.info.systemPriority then
  167. if info.systemPriority > frame.info.systemPriority then
  168. frame:Close();
  169. -- by design there can only be one such frame, no need to keep going
  170. break;
  171. else
  172. -- higher or equal priority is already shown
  173. return false;
  174. end
  175. end
  176. end
  177. end
  178. return true;
  179. end
  180. function HelpTip:ForceHideAll()
  181. self:SetHelpTipsEnabled("ForceHideAll", false);
  182. self.framePool:ReleaseAll();
  183. self:SetHelpTipsEnabled("ForceHideAll", true);
  184. end
  185. function HelpTip:HideAllSystem(system, text)
  186. local framesToClose = { };
  187. for frame in self.framePool:EnumerateActive() do
  188. if frame:MatchesSystem(system, text) then
  189. tinsert(framesToClose, frame);
  190. end
  191. end
  192. for i, frame in ipairs(framesToClose) do
  193. frame:Close();
  194. end
  195. end
  196. function HelpTip:HideAll(parent)
  197. local framesToClose = { };
  198. for frame in self.framePool:EnumerateActive() do
  199. if frame:Matches(parent) then
  200. tinsert(framesToClose, frame);
  201. end
  202. end
  203. for i, frame in ipairs(framesToClose) do
  204. frame:Close();
  205. end
  206. end
  207. function HelpTip:Hide(parent, text)
  208. for frame in self.framePool:EnumerateActive() do
  209. if frame:Matches(parent, text) then
  210. frame:Close();
  211. break;
  212. end
  213. end
  214. end
  215. function HelpTip:IsShowing(parent, text)
  216. for frame in self.framePool:EnumerateActive() do
  217. if frame:Matches(parent, text) then
  218. return true;
  219. end
  220. end
  221. return false;
  222. end
  223. function HelpTip:IsShowingAny(parent)
  224. for frame in self.framePool:EnumerateActive() do
  225. if frame:Matches(parent) then
  226. return true;
  227. end
  228. end
  229. return false;
  230. end
  231. function HelpTip:IsShowingAnyInSystem(system)
  232. for frame in self.framePool:EnumerateActive() do
  233. if frame.info.system == system then
  234. return true;
  235. end
  236. end
  237. return false;
  238. end
  239. function HelpTip:Acknowledge(parent, text)
  240. for frame in self.framePool:EnumerateActive() do
  241. if frame:Matches(parent, text) then
  242. frame:Acknowledge();
  243. break;
  244. end
  245. end
  246. end
  247. function HelpTip:AcknowledgeSystem(system, text)
  248. for frame in self.framePool:EnumerateActive() do
  249. if frame:MatchesSystem(system, text) then
  250. frame:Acknowledge();
  251. end
  252. end
  253. end
  254. function HelpTip:Release(helpTip)
  255. self.framePool:Release(helpTip);
  256. end
  257. function HelpTip:IsPointVertical(point)
  258. return point <= HelpTip.Point.BottomEdgeRight;
  259. end
  260. HelpTipTemplateMixin = { };
  261. local function TransformOffsetsForRotation(offsets, rotationInfo)
  262. local offsetX = offsets[1];
  263. local offsetY = offsets[2];
  264. if rotationInfo.swapOffsets then
  265. offsetX, offsetY = offsetY, offsetX;
  266. end
  267. offsetX = offsetX * rotationInfo.modOffsetX;
  268. offsetY = offsetY * rotationInfo.modOffsetY;
  269. return offsetX, offsetY;
  270. end
  271. function HelpTipTemplateMixin:OnLoad()
  272. self.Arrow.Arrow:ClearAllPoints();
  273. self.Arrow.Arrow:SetPoint("CENTER");
  274. self.Arrow.Glow:ClearAllPoints();
  275. self.acknowledged = false;
  276. end
  277. function HelpTipTemplateMixin:OnShow()
  278. self:RegisterEvent("UI_SCALE_CHANGED");
  279. self:RegisterEvent("DISPLAY_SIZE_CHANGED");
  280. end
  281. function HelpTipTemplateMixin:OnHide()
  282. self:UnregisterEvent("UI_SCALE_CHANGED");
  283. self:UnregisterEvent("DISPLAY_SIZE_CHANGED");
  284. local info = self.info;
  285. if info.onHideCallback then
  286. info.onHideCallback(self.acknowledged, info.callbackArg);
  287. end
  288. if not self.acknowledged and info.acknowledgeOnHide then
  289. self:HandleAcknowledge();
  290. end
  291. if self.acknowledged and info.onAcknowledgeCallback then
  292. info.onAcknowledgeCallback(info.callbackArg);
  293. end
  294. HelpTip:Release(self);
  295. end
  296. function HelpTipTemplateMixin:OnEvent()
  297. self:Layout();
  298. end
  299. -- this exists because OnHide can be deferred
  300. function HelpTipTemplateMixin:Close()
  301. self.closed = true;
  302. self:Hide();
  303. end
  304. function HelpTipTemplateMixin:OnUpdate()
  305. local rx, ry = self.relativeRegion:GetCenter();
  306. local targetPoint = self.info.targetPoint;
  307. local targetAlignment = self.info.alignment;
  308. if self.info.autoHorizontalSlide then
  309. -- check right edge first
  310. local rightEdge = UIParent:GetRight();
  311. local canFitOnRight = rx + self.width + HelpTip.ArrowOffsets[HelpTip.Alignment.Right][1] < rightEdge;
  312. if not canFitOnRight then
  313. if rx + HelpTip.halfWidth < rightEdge then
  314. targetAlignment = HelpTip.Alignment.Center;
  315. else
  316. targetAlignment = HelpTip.Alignment.Right;
  317. end
  318. else
  319. -- left edge
  320. local leftEdge = UIParent:GetLeft();
  321. local canFitOnLeft = rx - self.width + HelpTip.ArrowOffsets[HelpTip.Alignment.Left][1] > leftEdge;
  322. if not canFitOnLeft then
  323. if rx - HelpTip.halfWidth > leftEdge then
  324. targetAlignment = HelpTip.Alignment.Center;
  325. else
  326. targetAlignment = HelpTip.Alignment.Left;
  327. end
  328. end
  329. end
  330. end
  331. if self.info.autoEdgeFlipping then
  332. local ux, uy = UIParent:GetCenter();
  333. local useMin;
  334. if HelpTip:IsPointVertical(targetPoint) then
  335. useMin = ry <= uy;
  336. else
  337. useMin = rx <= ux;
  338. end
  339. if useMin then
  340. targetPoint = min(self.flippedTargetPoint, targetPoint);
  341. else
  342. targetPoint = max(self.flippedTargetPoint, targetPoint);
  343. end
  344. end
  345. self:AnchorAndRotate(targetPoint, targetAlignment);
  346. end
  347. function HelpTipTemplateMixin:Init(parent, info, relativeRegion)
  348. self:SetParent(parent);
  349. if info.useParentStrata then
  350. self:SetFrameLevel(9000);
  351. else
  352. self:SetFrameStrata("DIALOG");
  353. end
  354. self.info = info;
  355. self.relativeRegion = relativeRegion;
  356. if info.autoEdgeFlipping then
  357. local targetPoint = self:GetTargetPoint();
  358. local pointInfo = HelpTip.PointInfo[targetPoint];
  359. self.flippedTargetPoint = pointInfo.oppositePoint;
  360. self:SetScript("OnUpdate", function() self:OnUpdate(); end);
  361. end
  362. if info.autoHorizontalSlide then
  363. self:SetScript("OnUpdate", function() self:OnUpdate(); end);
  364. end
  365. self:AnchorAndRotate();
  366. self:Layout();
  367. end
  368. function HelpTipTemplateMixin:GetTargetPoint()
  369. return self.info.targetPoint or HelpTip.Point.BottomEdgeCenter;
  370. end
  371. function HelpTipTemplateMixin:GetAlignment()
  372. return self.info.alignment or HelpTip.Alignment.Center;
  373. end
  374. function HelpTipTemplateMixin:GetButtonInfo()
  375. local buttonStyle = self.info.buttonStyle or HelpTip.ButtonStyle.None;
  376. return HelpTip.Buttons[buttonStyle];
  377. end
  378. function HelpTipTemplateMixin:AnchorAndRotate(overrideTargetPoint, overrideAlignment)
  379. local baseTargetPoint = self:GetTargetPoint();
  380. local targetPoint = overrideTargetPoint or baseTargetPoint;
  381. local alignment = overrideAlignment or self:GetAlignment();
  382. if targetPoint == self.appliedTargetPoint and alignment == self.appliedAlignment then
  383. return;
  384. end
  385. local pointInfo = HelpTip.PointInfo[targetPoint];
  386. local rotationInfo = HelpTip.Rotations[pointInfo.arrowRotation];
  387. -- anchor
  388. local arrowAnchor = rotationInfo.anchors[alignment];
  389. local offsetX, offsetY = TransformOffsetsForRotation(HelpTip.DistanceOffsets[alignment], rotationInfo);
  390. local baseOffsetX = self.info.offsetX or 0;
  391. local baseOffsetY = self.info.offsetY or 0;
  392. if overrideTargetPoint and overrideTargetPoint ~= baseTargetPoint then
  393. if HelpTip:IsPointVertical(targetPoint) then
  394. baseOffsetY = -baseOffsetY;
  395. else
  396. baseOffsetX = -baseOffsetX;
  397. end
  398. end
  399. offsetX = offsetX + baseOffsetX;
  400. offsetY = offsetY + baseOffsetY;
  401. self:ClearAllPoints();
  402. self:SetPoint(arrowAnchor, self.relativeRegion, pointInfo.relativeAnchor, offsetX, offsetY);
  403. -- arrow
  404. if self.info.hideArrow then
  405. self.Arrow:Hide();
  406. else
  407. self.Arrow:Show();
  408. self:RotateArrow(pointInfo.arrowRotation);
  409. self:AnchorArrow(rotationInfo, alignment);
  410. end
  411. self.appliedAlignment = alignment;
  412. self.appliedTargetPoint = targetPoint;
  413. end
  414. function HelpTipTemplateMixin:Layout()
  415. local targetPoint = self:GetTargetPoint();
  416. local pointInfo = HelpTip.PointInfo[targetPoint];
  417. local buttonInfo = self:GetButtonInfo();
  418. -- starting defaults
  419. local textOffsetX = 15;
  420. local textOffsetY = 1;
  421. local textWidth = HelpTip.defaultTextWidth;
  422. local height = HelpTip.verticalPadding;
  423. -- button
  424. textWidth = textWidth + buttonInfo.textWidthAdj;
  425. textOffsetY = textOffsetY + buttonInfo.heightAdj / 2;
  426. height = height + buttonInfo.heightAdj;
  427. if buttonInfo.parentKey then
  428. self[buttonInfo.parentKey]:Show();
  429. if buttonInfo.text then
  430. self[buttonInfo.parentKey]:SetText(buttonInfo.text);
  431. end
  432. end
  433. -- set height based on the text
  434. self:ApplyText();
  435. self.Text:SetWidth(textWidth);
  436. self.Text:SetPoint("LEFT", textOffsetX, textOffsetY);
  437. height = height + self.Text:GetHeight();
  438. if pointInfo.arrowRotation == HelpTip.ArrowRotation.Left or pointInfo.arrowRotation == HelpTip.ArrowRotation.Right then
  439. height = max(height, HelpTip.minimumHeight);
  440. end
  441. self:SetHeight(height);
  442. end
  443. function HelpTipTemplateMixin:ApplyText()
  444. local info = self.info;
  445. self.Text:SetText(info.text);
  446. local color = info.textColor or HIGHLIGHT_FONT_COLOR;
  447. self.Text:SetTextColor(color:GetRGB());
  448. local justifyH = info.textJustifyH;
  449. if not justifyH then
  450. if self.Text:GetNumLines() == 1 then
  451. justifyH = "CENTER";
  452. else
  453. justifyH = "LEFT";
  454. end
  455. end
  456. self.Text:SetJustifyH(justifyH);
  457. end
  458. function HelpTipTemplateMixin:AnchorArrow(rotationInfo, alignment)
  459. local arrowAnchor = rotationInfo.anchors[alignment];
  460. local offsetX, offsetY = TransformOffsetsForRotation(HelpTip.ArrowOffsets[alignment], rotationInfo);
  461. self.Arrow:ClearAllPoints();
  462. self.Arrow:SetPoint("CENTER", self, arrowAnchor, offsetX, offsetY);
  463. end
  464. function HelpTipTemplateMixin:RotateArrow(rotation)
  465. if self.Arrow.rotation == rotation then
  466. return;
  467. end
  468. local rotationInfo = HelpTip.Rotations[rotation];
  469. SetClampedTextureRotation(self.Arrow.Arrow, rotationInfo.degrees);
  470. SetClampedTextureRotation(self.Arrow.Glow, rotationInfo.degrees);
  471. local offsetX, offsetY = TransformOffsetsForRotation(HelpTip.ArrowGlowOffsets, rotationInfo);
  472. self.Arrow.Glow:SetPoint("CENTER", self.Arrow.Arrow, "CENTER", offsetX, offsetY);
  473. self.Arrow.rotation = rotation;
  474. end
  475. function HelpTipTemplateMixin:Acknowledge()
  476. self:HandleAcknowledge();
  477. self:Close();
  478. end
  479. function HelpTipTemplateMixin:HandleAcknowledge()
  480. local info = self.info;
  481. if info.cvar then
  482. SetCVar(info.cvar, info.cvarValue);
  483. end
  484. if info.cvarBitfield then
  485. SetCVarBitfield(info.cvarBitfield, info.bitfieldFlag, true);
  486. end
  487. self.acknowledged = true;
  488. end
  489. function HelpTipTemplateMixin:Reset()
  490. self.info = nil;
  491. self.relativeRegion = nil;
  492. self.closed = false;
  493. self.acknowledged = false;
  494. self.CloseButton:Hide();
  495. self.OkayButton:Hide();
  496. -- flippity flip settings
  497. self.appliedTargetPoint = nil;
  498. self.flippedTargetPoint = nil;
  499. self.appliedAlignment = nil;
  500. self:SetScript("OnUpdate", nil);
  501. end
  502. function HelpTipTemplateMixin:Matches(parent, text)
  503. if self.closed then
  504. return false;
  505. end
  506. local textMatched = not text or self.info.text == text;
  507. return textMatched and self:GetParent() == parent;
  508. end
  509. function HelpTipTemplateMixin:MatchesSystem(system, text)
  510. if self.closed then
  511. return false;
  512. end
  513. local textMatched = not text or self.info.text == text;
  514. return textMatched and self.info.system == system;
  515. end