暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GridSelectionScaleTool.cs 1.3KB

1234567891011121314151617181920212223242526272829303132
  1. using UnityEditor.EditorTools;
  2. using UnityEngine;
  3. namespace UnityEditor.Tilemaps
  4. {
  5. /// <summary>
  6. /// An `EditorTool` for handling Scale for a `GridSelection`.
  7. /// </summary>
  8. public class GridSelectionScaleTool : GridSelectionTool
  9. {
  10. private static class Styles
  11. {
  12. public static readonly GUIContent toolbarIcon = EditorGUIUtility.TrTextContentWithIcon("Scale", "Shows a Gizmo in the Scene view for changing the scale for the Grid Selection", "ScaleTool");
  13. }
  14. /// <summary>
  15. /// Toolbar icon for the `GridSelectionScaleTool`.
  16. /// </summary>
  17. public override GUIContent toolbarIcon => Styles.toolbarIcon;
  18. /// <summary>
  19. /// Handles the gizmo for managing Rotation for the `GridSelectionScaleTool`.
  20. /// </summary>
  21. /// <param name="position">Position of the `GridSelection` gizmo.</param>
  22. /// <param name="rotation">Rotation of the `GridSelection` gizmo.</param>
  23. /// <param name="scale">Scale of the `GridSelection` gizmo.</param>
  24. public override void HandleTool(ref Vector3 position, ref Quaternion rotation, ref Vector3 scale)
  25. {
  26. scale = Handles.ScaleHandle(scale, position, rotation, HandleUtility.GetHandleSize(position));
  27. }
  28. }
  29. }