private void DoRangesGUI() { var radius = controller.radius; EditorGUILayout.Space(); EditorGUILayout.Space(); var rect = EditorGUILayout.GetControlRect(false, radius * 2f); if (Event.current.type == EventType.Repaint) { m_AngleRangeRect = rect; } { //Draw background var backgroundColor = Contents.proBackgroundColor; var backgroundRangeColor = Contents.proBackgroundRangeColor; if (!EditorGUIUtility.isProSkin) { backgroundColor = Contents.defaultBackgroundColor; backgroundRangeColor.a = 0.1f; } var c = Handles.color; Handles.color = backgroundRangeColor; SpriteShapeHandleUtility.DrawSolidArc(rect.center, Vector3.forward, Vector3.right, 360f, radius, AngleRangeGUI.kRangeWidth); Handles.color = backgroundColor; Handles.DrawSolidDisc(rect.center, Vector3.forward, radius - AngleRangeGUI.kRangeWidth + 1f); Handles.color = c; } if (targets.Length == 1) { { //Draw fill texture and sprite preview SpriteShapeHandleUtility.DrawTextureArc( m_FillTextureProp.objectReferenceValue as Texture, 100.0f, rect.center, Vector3.forward, Quaternion.AngleAxis(m_PreviewAngle, Vector3.forward) * Vector3.right, 180f, radius - AngleRangeGUI.kRangeWidth); var rectSize = Vector2.one * (radius - AngleRangeGUI.kRangeWidth) * 2f; rectSize.y *= 0.33f; var spriteRect = new Rect(rect.center - rectSize * 0.5f, rectSize); DrawSpritePreview(spriteRect); HandleSpritePreviewCycle(spriteRect); } controller.rect = m_AngleRangeRect; controller.OnGUI(); } EditorGUILayout.Space(); EditorGUILayout.Space(); }
public void CreateSingleRangeIs90DegAndSelected() { m_AngleFromPosition = 0f; m_View.IsActionActive(AngleRangeAction.CreateRange).Returns(true); m_View.DoCreateRange(Arg.Any <Rect>(), Arg.Any <float>(), Arg.Any <float>(), Arg.Any <float>(), Arg.Any <float>()).Returns(true); m_Controller.OnGUI(); Assert.AreEqual(1, m_AngleRanges.Count); Assert.AreEqual(90f, m_AngleRanges[0].end - m_AngleRanges[0].start); Assert.AreEqual(0, m_Cache.selectedIndex); m_Cache.Received().RegisterUndo(Arg.Any <string>()); }