protected float HandleBorderScaleSlider(float x, float y, float width, float height, bool isHorizontal) { float handleSize = styles.dragBorderdot.fixedWidth; Vector2 point = Handles.matrix.MultiplyPoint(new Vector2(x, y)); float result; EditorGUI.BeginChangeCheck(); if (isHorizontal) { Rect newRect = new Rect(point.x - handleSize * .5f, point.y, handleSize, height); result = SpriteEditorHandles.ScaleSlider(point, MouseCursor.ResizeHorizontal, newRect).x; } else { Rect newRect = new Rect(point.x, point.y - handleSize * .5f, width, handleSize); result = SpriteEditorHandles.ScaleSlider(point, MouseCursor.ResizeVertical, newRect).y; } if (EditorGUI.EndChangeCheck()) { return(result); } return(isHorizontal ? x : y); }
protected float HandleBorderScaleSlider(float x, float y, float width, float height, bool isHorizontal) { float fixedWidth = SpriteFrameModuleBase.styles.dragBorderdot.fixedWidth; Vector2 pos = Handles.matrix.MultiplyPoint(new Vector2(x, y)); EditorGUI.BeginChangeCheck(); float num; if (isHorizontal) { Rect cursorRect = new Rect(pos.x - fixedWidth * 0.5f, pos.y, fixedWidth, height); num = SpriteEditorHandles.ScaleSlider(pos, MouseCursor.ResizeHorizontal, cursorRect).x; } else { Rect cursorRect2 = new Rect(pos.x, pos.y - fixedWidth * 0.5f, width, fixedWidth); num = SpriteEditorHandles.ScaleSlider(pos, MouseCursor.ResizeVertical, cursorRect2).y; } float result; if (EditorGUI.EndChangeCheck()) { result = num; } else { result = ((!isHorizontal) ? y : x); } return(result); }