using UnityEditor.EditorTools; using UnityEngine; namespace UnityEditor.Tilemaps { /// /// An `EditorTool` for handling Scale for a `GridSelection`. /// public class GridSelectionScaleTool : GridSelectionTool { private static class Styles { public static readonly GUIContent toolbarIcon = EditorGUIUtility.TrTextContentWithIcon("Scale", "Shows a Gizmo in the Scene view for changing the scale for the Grid Selection", "ScaleTool"); } /// /// Toolbar icon for the `GridSelectionScaleTool`. /// public override GUIContent toolbarIcon => Styles.toolbarIcon; /// /// Handles the gizmo for managing Rotation for the `GridSelectionScaleTool`. /// /// Position of the `GridSelection` gizmo. /// Rotation of the `GridSelection` gizmo. /// Scale of the `GridSelection` gizmo. public override void HandleTool(ref Vector3 position, ref Quaternion rotation, ref Vector3 scale) { scale = Handles.ScaleHandle(scale, position, rotation, HandleUtility.GetHandleSize(position)); } } }