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

Method Draw

Source/Editor/Surface/SurfaceComment.cs:163–208  ·  view source on GitHub ↗

()

Source from the content-addressed store, hash-verified

161
162 /// <inheritdoc />
163 public override void Draw()
164 {
165 var style = Style.Current;
166 var color = Color;
167 var backgroundRect = new Rectangle(Float2.Zero, Size);
168 var headerColor = new Color(Mathf.Clamp(color.R, 0.1f, 0.3f), Mathf.Clamp(color.G, 0.1f, 0.3f), Mathf.Clamp(color.B, 0.1f, 0.3f), 0.4f);
169 if (IsSelected && !_isRenaming)
170 headerColor *= 2.0f;
171
172 // Paint background
173 Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), BackgroundColor);
174
175 // Draw child controls
176 DrawChildren();
177
178 // Header
179 Render2D.FillRectangle(_headerRect, headerColor);
180 if (!_isRenaming)
181 Render2D.DrawText(style.FontLarge, Title, _headerRect, style.Foreground, TextAlignment.Center, TextAlignment.Center);
182
183 if (Surface.CanEdit)
184 {
185 // Close button
186 DrawCloseButton(_closeButtonRect, _closeButtonRect.Contains(_mousePosition) && Surface.CanEdit ? style.Foreground : style.ForegroundGrey);
187
188 // Color button
189 Render2D.DrawSprite(style.Settings, _colorButtonRect, _colorButtonRect.Contains(_mousePosition) && Surface.CanEdit ? style.Foreground : style.ForegroundGrey);
190
191 // Resize button
192 if (_isResizing)
193 {
194 Render2D.FillRectangle(_resizeButtonRect, style.Selection);
195 Render2D.DrawRectangle(_resizeButtonRect, style.SelectionBorder);
196 }
197 Render2D.DrawSprite(style.Scale, _resizeButtonRect, _resizeButtonRect.Contains(_mousePosition) ? style.Foreground : style.ForegroundGrey);
198 }
199
200 // Selection outline
201 if (_isSelected)
202 {
203 backgroundRect.Expand(1.5f);
204 var colorTop = Color.Orange;
205 var colorBottom = Color.OrangeRed;
206 Render2D.DrawRectangle(backgroundRect, colorTop, colorTop, colorBottom, colorBottom);
207 }
208 }
209
210 /// <inheritdoc />
211 protected override Float2 CalculateNodeSize(float width, float height)

Callers

nothing calls this directly

Calls 7

FillRectangleMethod · 0.80
DrawRectangleMethod · 0.80
ClampMethod · 0.45
DrawTextMethod · 0.45
ContainsMethod · 0.45
DrawSpriteMethod · 0.45
ExpandMethod · 0.45

Tested by

no test coverage detected