diff --git a/Source/Editor/Gizmo/ViewportRubberBandSelector.cs b/Source/Editor/Gizmo/ViewportRubberBandSelector.cs
index 0381c6535..735ae03a3 100644
--- a/Source/Editor/Gizmo/ViewportRubberBandSelector.cs
+++ b/Source/Editor/Gizmo/ViewportRubberBandSelector.cs
@@ -11,7 +11,7 @@ namespace FlaxEngine.Gizmo;
///
/// Class for adding viewport rubber band selection.
///
-public class ViewportRubberBandSelector
+public sealed class ViewportRubberBandSelector
{
private bool _isMosueCaptured;
private bool _isRubberBandSpanning;
@@ -232,30 +232,15 @@ public class ViewportRubberBandSelector
}
///
- /// Used to draw the rubber band. Begins render 2D.
+ /// Draws the ruber band during owner viewport UI drawing.
///
- /// The GPU Context.
- /// The GPU texture target.
- /// The GPU texture target depth.
- public void Draw(GPUContext context, GPUTexture target, GPUTexture targetDepth)
- {
- // Draw RubberBand for rect selection
- if (!_isRubberBandSpanning)
- return;
- Render2D.Begin(context, target, targetDepth);
- Draw2D();
- Render2D.End();
- }
-
- ///
- /// Used to draw the rubber band. Use if already rendering 2D context.
- ///
- public void Draw2D()
+ public void Draw()
{
if (!_isRubberBandSpanning)
return;
- Render2D.FillRectangle(_rubberBandRect, Style.Current.Selection);
- Render2D.DrawRectangle(_rubberBandRect, Style.Current.SelectionBorder);
+ var style = Style.Current;
+ Render2D.FillRectangle(_rubberBandRect, style.Selection);
+ Render2D.DrawRectangle(_rubberBandRect, style.SelectionBorder);
}
///
diff --git a/Source/Editor/Viewport/MainEditorGizmoViewport.cs b/Source/Editor/Viewport/MainEditorGizmoViewport.cs
index 943bb6e3c..ddf058e58 100644
--- a/Source/Editor/Viewport/MainEditorGizmoViewport.cs
+++ b/Source/Editor/Viewport/MainEditorGizmoViewport.cs
@@ -375,10 +375,7 @@ namespace FlaxEditor.Viewport
{
Gizmos[i].Draw(ref renderContext);
}
-
- // Draw RubberBand for rect selection
- _rubberBandSelector.Draw(context, target, targetDepth);
-
+
// Draw selected objects debug shapes and visuals
if (DrawDebugDraw && (renderContext.View.Flags & ViewFlags.DebugDraw) == ViewFlags.DebugDraw)
{
@@ -594,6 +591,15 @@ namespace FlaxEditor.Viewport
}
}
+ ///
+ public override void Draw()
+ {
+ base.Draw();
+
+ // Draw rubber band for rectangle selection
+ _rubberBandSelector.Draw();
+ }
+
///
protected override void OrientViewport(ref Quaternion orientation)
{