HelpTip.lua

HelpTip.lua (9.1.5.40906; unchanged since 9.1.5.40871)
  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. if GetCVarBool("hideHelptips") then
  122. return false;
  123. end
  124. for flagType, flagValue in pairs(self.supressHelpTips) do
  125. if not flagValue then
  126. return false;
  127. end
  128. end
  129. return true;
  130. end
  131. function HelpTip:Show(parent, info, relativeRegion)
  132. assert(info and info.text, "Invalid helptip info");
  133. assert((info.bitfieldFlag ~= nil and info.cvarBitfield ~= nil) or (info.bitfieldFlag == nil and info.cvarBitfield == nil));
  134. if not self:CanShow(info) then
  135. return false;
  136. end
  137. if self:IsShowing(parent, info.text) then
  138. return true;
  139. end
  140. local frame = self.framePool:Acquire();
  141. frame.width = HelpTip.width + (info.extraRightMarginPadding or 0);
  142. frame:SetWidth(frame.width);
  143. frame:Init(parent, info, relativeRegion or parent);
  144. frame:Show();
  145. return true;
  146. end
  147. function HelpTip:CanShow(info)
  148. if Kiosk.IsEnabled() then
  149. return false;
  150. end
  151. if not self:AreHelpTipsEnabled() then
  152. return false;
  153. end
  154. if info.checkCVars then
  155. if info.cvar then
  156. if GetCVar(info.cvar) ~= info.cvarValue then
  157. return false;
  158. end
  159. end
  160. if info.cvarBitfield then
  161. if GetCVarBitfield(info.cvarBitfield, info.bitfieldFlag) then
  162. return false;
  163. end
  164. end
  165. end
  166. -- priority
  167. if info.system and info.systemPriority then
  168. for frame in self.framePool:EnumerateActive() do
  169. if frame.info.system == info.system and frame.info.systemPriority then
  170. if info.systemPriority > frame.info.systemPriority then
  171. frame:Close();
  172. -- by design there can only be one such frame, no need to keep going
  173. break;
  174. else
  175. -- higher or equal priority is already shown
  176. return false;
  177. end
  178. end
  179. end
  180. end
  181. return true;
  182. end
  183. function HelpTip:ForceHideAll()
  184. self:SetHelpTipsEnabled("ForceHideAll", false);
  185. self.framePool:ReleaseAll();
  186. self:SetHelpTipsEnabled("ForceHideAll", true);
  187. end
  188. function HelpTip:HideAllSystem(system, text)
  189. local framesToClose = { };
  190. for frame in self.framePool:EnumerateActive() do
  191. if frame:MatchesSystem(system, text) then
  192. tinsert(framesToClose, frame);
  193. end
  194. end
  195. for i, frame in ipairs(framesToClose) do
  196. frame:Close();
  197. end
  198. end
  199. function HelpTip:HideAll(parent)
  200. local framesToClose = { };
  201. for frame in self.framePool:EnumerateActive() do
  202. if frame:Matches(parent) then
  203. tinsert(framesToClose, frame);
  204. end
  205. end
  206. for i, frame in ipairs(framesToClose) do
  207. frame:Close();
  208. end
  209. end
  210. function HelpTip:Hide(parent, text)
  211. for frame in self.framePool:EnumerateActive() do
  212. if frame:Matches(parent, text) then
  213. frame:Close();
  214. break;
  215. end
  216. end
  217. end
  218. function HelpTip:IsShowing(parent, text)
  219. for frame in self.framePool:EnumerateActive() do
  220. if frame:Matches(parent, text) then
  221. return true;
  222. end
  223. end
  224. return false;
  225. end
  226. function HelpTip:IsShowingAny(parent)
  227. for frame in self.framePool:EnumerateActive() do
  228. if frame:Matches(parent) then
  229. return true;
  230. end
  231. end
  232. return false;
  233. end
  234. function HelpTip:IsShowingAnyInSystem(system)
  235. for frame in self.framePool:EnumerateActive() do
  236. if frame.info.system == system then
  237. return true;
  238. end
  239. end
  240. return false;
  241. end
  242. function HelpTip:Acknowledge(parent, text)
  243. for frame in self.framePool:EnumerateActive() do
  244. if frame:Matches(parent, text) then
  245. frame:Acknowledge();
  246. break;
  247. end
  248. end
  249. end
  250. function HelpTip:AcknowledgeSystem(system, text)
  251. for frame in self.framePool:EnumerateActive() do
  252. if frame:MatchesSystem(system, text) then
  253. frame:Acknowledge();
  254. end
  255. end
  256. end
  257. function HelpTip:Release(helpTip)
  258. self.framePool:Release(helpTip);
  259. end
  260. function HelpTip:IsPointVertical(point)
  261. return point <= HelpTip.Point.BottomEdgeRight;
  262. end
  263. HelpTipTemplateMixin = { };
  264. local function TransformOffsetsForRotation(offsets, rotationInfo)
  265. local offsetX = offsets[1];
  266. local offsetY = offsets[2];
  267. if rotationInfo.swapOffsets then
  268. offsetX, offsetY = offsetY, offsetX;
  269. end
  270. offsetX = offsetX * rotationInfo.modOffsetX;
  271. offsetY = offsetY * rotationInfo.modOffsetY;
  272. return offsetX, offsetY;
  273. end
  274. function HelpTipTemplateMixin:OnLoad()
  275. self.Arrow.Arrow:ClearAllPoints();
  276. self.Arrow.Arrow:SetPoint("CENTER");
  277. self.Arrow.Glow:ClearAllPoints();
  278. self.acknowledged = false;
  279. end
  280. function HelpTipTemplateMixin:OnShow()
  281. self:RegisterEvent("UI_SCALE_CHANGED");
  282. self:RegisterEvent("DISPLAY_SIZE_CHANGED");
  283. end
  284. function HelpTipTemplateMixin:OnHide()
  285. self:UnregisterEvent("UI_SCALE_CHANGED");
  286. self:UnregisterEvent("DISPLAY_SIZE_CHANGED");
  287. local info = self.info;
  288. if info.onHideCallback then
  289. info.onHideCallback(self.acknowledged, info.callbackArg);
  290. end
  291. if not self.acknowledged and info.acknowledgeOnHide then
  292. self:HandleAcknowledge();
  293. end
  294. if self.acknowledged and info.onAcknowledgeCallback then
  295. info.onAcknowledgeCallback(info.callbackArg);
  296. end
  297. HelpTip:Release(self);
  298. end
  299. function HelpTipTemplateMixin:OnEvent()
  300. self:Layout();
  301. end
  302. -- this exists because OnHide can be deferred
  303. function HelpTipTemplateMixin:Close()
  304. self.closed = true;
  305. self:Hide();
  306. end
  307. function HelpTipTemplateMixin:OnUpdate()
  308. local rx, ry = self.relativeRegion:GetCenter();
  309. local targetPoint = self.info.targetPoint;
  310. local targetAlignment = self.info.alignment;
  311. if self.info.autoHorizontalSlide then
  312. -- check right edge first
  313. local rightEdge = UIParent:GetRight();
  314. local canFitOnRight = rx + self.width + HelpTip.ArrowOffsets[HelpTip.Alignment.Right][1] < rightEdge;
  315. if not canFitOnRight then
  316. if rx + HelpTip.halfWidth < rightEdge then
  317. targetAlignment = HelpTip.Alignment.Center;
  318. else
  319. targetAlignment = HelpTip.Alignment.Right;
  320. end
  321. else
  322. -- left edge
  323. local leftEdge = UIParent:GetLeft();
  324. local canFitOnLeft = rx - self.width + HelpTip.ArrowOffsets[HelpTip.Alignment.Left][1] > leftEdge;
  325. if not canFitOnLeft then
  326. if rx - HelpTip.halfWidth > leftEdge then
  327. targetAlignment = HelpTip.Alignment.Center;
  328. else
  329. targetAlignment = HelpTip.Alignment.Left;
  330. end
  331. end
  332. end
  333. end
  334. if self.info.autoEdgeFlipping then
  335. local ux, uy = UIParent:GetCenter();
  336. local useMin;
  337. if HelpTip:IsPointVertical(targetPoint) then
  338. useMin = ry <= uy;
  339. else
  340. useMin = rx <= ux;
  341. end
  342. if useMin then
  343. targetPoint = min(self.flippedTargetPoint, targetPoint);
  344. else
  345. targetPoint = max(self.flippedTargetPoint, targetPoint);
  346. end
  347. end
  348. self:AnchorAndRotate(targetPoint, targetAlignment);
  349. end
  350. function HelpTipTemplateMixin:Init(parent, info, relativeRegion)
  351. self:SetParent(parent);
  352. if info.useParentStrata then
  353. self:SetFrameLevel(9000);
  354. else
  355. self:SetFrameStrata("DIALOG");
  356. end
  357. self.info = info;
  358. self.relativeRegion = relativeRegion;
  359. if info.autoEdgeFlipping then
  360. local targetPoint = self:GetTargetPoint();
  361. local pointInfo = HelpTip.PointInfo[targetPoint];
  362. self.flippedTargetPoint = pointInfo.oppositePoint;
  363. self:SetScript("OnUpdate", function() self:OnUpdate(); end);
  364. end
  365. if info.autoHorizontalSlide then
  366. self:SetScript("OnUpdate", function() self:OnUpdate(); end);
  367. end
  368. self:AnchorAndRotate();
  369. self:Layout();
  370. end
  371. function HelpTipTemplateMixin:GetTargetPoint()
  372. return self.info.targetPoint or HelpTip.Point.BottomEdgeCenter;
  373. end
  374. function HelpTipTemplateMixin:GetAlignment()
  375. return self.info.alignment or HelpTip.Alignment.Center;
  376. end
  377. function HelpTipTemplateMixin:GetButtonInfo()
  378. local buttonStyle = self.info.buttonStyle or HelpTip.ButtonStyle.None;
  379. return HelpTip.Buttons[buttonStyle];
  380. end
  381. function HelpTipTemplateMixin:AnchorAndRotate(overrideTargetPoint, overrideAlignment)
  382. local baseTargetPoint = self:GetTargetPoint();
  383. local targetPoint = overrideTargetPoint or baseTargetPoint;
  384. local alignment = overrideAlignment or self:GetAlignment();
  385. if targetPoint == self.appliedTargetPoint and alignment == self.appliedAlignment then
  386. return;
  387. end
  388. local pointInfo = HelpTip.PointInfo[targetPoint];
  389. local rotationInfo = HelpTip.Rotations[pointInfo.arrowRotation];
  390. -- anchor
  391. local arrowAnchor = rotationInfo.anchors[alignment];
  392. local offsetX, offsetY = TransformOffsetsForRotation(HelpTip.DistanceOffsets[alignment], rotationInfo);
  393. local baseOffsetX = self.info.offsetX or 0;
  394. local baseOffsetY = self.info.offsetY or 0;
  395. if overrideTargetPoint and overrideTargetPoint ~= baseTargetPoint then
  396. if HelpTip:IsPointVertical(targetPoint) then
  397. baseOffsetY = -baseOffsetY;
  398. else
  399. baseOffsetX = -baseOffsetX;
  400. end
  401. end
  402. offsetX = offsetX + baseOffsetX;
  403. offsetY = offsetY + baseOffsetY;
  404. self:ClearAllPoints();
  405. self:SetPoint(arrowAnchor, self.relativeRegion, pointInfo.relativeAnchor, offsetX, offsetY);
  406. -- arrow
  407. if self.info.hideArrow then
  408. self.Arrow:Hide();
  409. else
  410. self.Arrow:Show();
  411. self:RotateArrow(pointInfo.arrowRotation);
  412. self:AnchorArrow(rotationInfo, alignment);
  413. end
  414. self.appliedAlignment = alignment;
  415. self.appliedTargetPoint = targetPoint;
  416. end
  417. function HelpTipTemplateMixin:Layout()
  418. local targetPoint = self:GetTargetPoint();
  419. local pointInfo = HelpTip.PointInfo[targetPoint];
  420. local buttonInfo = self:GetButtonInfo();
  421. -- starting defaults
  422. local textOffsetX = 15;
  423. local textOffsetY = 1;
  424. local textWidth = HelpTip.defaultTextWidth;
  425. local height = HelpTip.verticalPadding;
  426. -- button
  427. textWidth = textWidth + buttonInfo.textWidthAdj;
  428. textOffsetY = textOffsetY + buttonInfo.heightAdj / 2;
  429. height = height + buttonInfo.heightAdj;
  430. if buttonInfo.parentKey then
  431. self[buttonInfo.parentKey]:Show();
  432. if buttonInfo.text then
  433. self[buttonInfo.parentKey]:SetText(buttonInfo.text);
  434. end
  435. end
  436. -- set height based on the text
  437. self:ApplyText();
  438. self.Text:SetWidth(textWidth);
  439. self.Text:SetPoint("LEFT", textOffsetX, textOffsetY);
  440. height = height + self.Text:GetHeight();
  441. if pointInfo.arrowRotation == HelpTip.ArrowRotation.Left or pointInfo.arrowRotation == HelpTip.ArrowRotation.Right then
  442. height = max(height, HelpTip.minimumHeight);
  443. end
  444. self:SetHeight(height);
  445. end
  446. function HelpTipTemplateMixin:ApplyText()
  447. local info = self.info;
  448. self.Text:SetText(info.text);
  449. local color = info.textColor or HIGHLIGHT_FONT_COLOR;
  450. self.Text:SetTextColor(color:GetRGB());
  451. local justifyH = info.textJustifyH;
  452. if not justifyH then
  453. if self.Text:GetNumLines() == 1 then
  454. justifyH = "CENTER";
  455. else
  456. justifyH = "LEFT";
  457. end
  458. end
  459. self.Text:SetJustifyH(justifyH);
  460. end
  461. function HelpTipTemplateMixin:AnchorArrow(rotationInfo, alignment)
  462. local arrowAnchor = rotationInfo.anchors[alignment];
  463. local offsetX, offsetY = TransformOffsetsForRotation(HelpTip.ArrowOffsets[alignment], rotationInfo);
  464. self.Arrow:ClearAllPoints();
  465. self.Arrow:SetPoint("CENTER", self, arrowAnchor, offsetX, offsetY);
  466. end
  467. function HelpTipTemplateMixin:RotateArrow(rotation)
  468. if self.Arrow.rotation == rotation then
  469. return;
  470. end
  471. local rotationInfo = HelpTip.Rotations[rotation];
  472. SetClampedTextureRotation(self.Arrow.Arrow, rotationInfo.degrees);
  473. SetClampedTextureRotation(self.Arrow.Glow, rotationInfo.degrees);
  474. local offsetX, offsetY = TransformOffsetsForRotation(HelpTip.ArrowGlowOffsets, rotationInfo);
  475. self.Arrow.Glow:SetPoint("CENTER", self.Arrow.Arrow, "CENTER", offsetX, offsetY);
  476. self.Arrow.rotation = rotation;
  477. end
  478. function HelpTipTemplateMixin:Acknowledge()
  479. self:HandleAcknowledge();
  480. self:Close();
  481. end
  482. function HelpTipTemplateMixin:HandleAcknowledge()
  483. local info = self.info;
  484. if info.cvar then
  485. SetCVar(info.cvar, info.cvarValue);
  486. end
  487. if info.cvarBitfield then
  488. SetCVarBitfield(info.cvarBitfield, info.bitfieldFlag, true);
  489. end
  490. self.acknowledged = true;
  491. end
  492. function HelpTipTemplateMixin:Reset()
  493. self.info = nil;
  494. self.relativeRegion = nil;
  495. self.closed = false;
  496. self.acknowledged = false;
  497. self.CloseButton:Hide();
  498. self.OkayButton:Hide();
  499. -- flippity flip settings
  500. self.appliedTargetPoint = nil;
  501. self.flippedTargetPoint = nil;
  502. self.appliedAlignment = nil;
  503. self:SetScript("OnUpdate", nil);
  504. end
  505. function HelpTipTemplateMixin:Matches(parent, text)
  506. if self.closed then
  507. return false;
  508. end
  509. local textMatched = not text or self.info.text == text;
  510. return textMatched and self:GetParent() == parent;
  511. end
  512. function HelpTipTemplateMixin:MatchesSystem(system, text)
  513. if self.closed then
  514. return false;
  515. end
  516. local textMatched = not text or self.info.text == text;
  517. return textMatched and self.info.system == system;
  518. end