(
actor: Clutter.Actor,
params: Partial<MatTooltipParams>
)
| 58 | } |
| 59 | |
| 60 | createTooltip( |
| 61 | actor: Clutter.Actor, |
| 62 | params: Partial<MatTooltipParams> |
| 63 | ): MatTooltip | undefined { |
| 64 | // If actor has text, use it instead because it may be updated |
| 65 | let actorText: string | undefined; |
| 66 | if (actor instanceof St.Label || actor instanceof Clutter.Text) { |
| 67 | const clutterText = |
| 68 | actor instanceof St.Label |
| 69 | ? (actor.get_clutter_text() as Clutter.Text) |
| 70 | : actor; |
| 71 | if (clutterText.get_layout().is_ellipsized()) { |
| 72 | actorText = clutterText.get_text()!; |
| 73 | } |
| 74 | } |
| 75 | if (actorText) params.text = actorText; |
| 76 | |
| 77 | if (!params.text) { |
| 78 | return; |
| 79 | } |
| 80 | const tooltip = new MatTooltip(actor, params); |
| 81 | Main.layoutManager.addChrome(tooltip); |
| 82 | tooltip.show(); |
| 83 | return tooltip; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | enum TooltipSide { |
no test coverage detected