MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / PerformLayoutBeforeChildren

Method PerformLayoutBeforeChildren

Source/Engine/UI/GUI/Tooltip.cs:283–315  ·  view source on GitHub ↗

()

Source from the content-addressed store, hash-verified

281
282 /// <inheritdoc />
283 protected override void PerformLayoutBeforeChildren()
284 {
285 base.PerformLayoutBeforeChildren();
286
287 var prevSize = Size;
288 var style = Style.Current;
289
290 // Calculate size of the tooltip
291 var size = Float2.Zero;
292 if (style != null && style.FontMedium && !string.IsNullOrEmpty(_currentText))
293 {
294 var layout = TextLayoutOptions.Default;
295 layout.Bounds = new Rectangle(0, 0, MaxWidth, 10000000);
296 layout.HorizontalAlignment = TextAlignment.Center;
297 layout.VerticalAlignment = TextAlignment.Center;
298 layout.TextWrapping = TextWrapping.WrapWords;
299 var items = style.FontMedium.ProcessText(_currentText, ref layout);
300 for (int i = 0; i < items.Length; i++)
301 {
302 ref var item = ref items[i];
303 size.X = Mathf.Max(size.X, item.Size.X + 8.0f);
304 size.Y += item.Size.Y;
305 }
306 //size.X += style.FontMedium.MeasureText(_currentText).X;
307 }
308 Size = size + new Float2(24.0f);
309
310 // Check if is visible size get changed
311 if (Visible && prevSize != Size)
312 {
313 UpdateWindowSize();
314 }
315 }
316
317 /// <inheritdoc />
318 public override bool OnShowTooltip(out string text, out Float2 location, out Rectangle area)

Callers

nothing calls this directly

Calls 2

ProcessTextMethod · 0.80
MaxMethod · 0.45

Tested by

no test coverage detected