예제 #1
0
        /// <summary>
        /// Converts coordinates in window space (relative to the parent window origin) into coordinates in curve space.
        /// </summary>
        /// <param name="windowPos">Coordinates relative to parent editor window, in pixels.</param>
        /// <param name="curveCoord">Curve coordinates within the range as specified by <see cref="Range"/>. Only
        ///                          valid when function returns true.</param>
        /// <returns>True if the coordinates are within the curve area, false otherwise.</returns>
        public bool WindowToCurveSpace(Vector2I windowPos, out Vector2 curveCoord)
        {
            Rect2I   elementBounds = GUIUtility.CalculateBounds(gui, window.GUI);
            Vector2I pointerPos    = windowPos - new Vector2I(elementBounds.x, elementBounds.y);

            Rect2I   drawingBounds = drawingPanel.Bounds;
            Vector2I drawingPos    = pointerPos - new Vector2I(drawingBounds.x, drawingBounds.y);

            return(guiCurveDrawing.PixelToCurveSpace(drawingPos, out curveCoord));
        }
예제 #2
0
 /// <summary>
 /// Converts pixel coordinates relative to the curve drawing area into coordinates in curve space.
 /// </summary>
 /// <param name="pixelCoords">Coordinates relative to this GUI element, in pixels.</param>
 /// <param name="curveCoords">Curve coordinates within the range as specified by <see cref="Range"/>. Only
 ///                           valid when function returns true.</param>
 /// <returns>True if the coordinates are within the curve area, false otherwise.</returns>
 public bool PixelToCurveSpace(Vector2I pixelCoords, out Vector2 curveCoords)
 {
     return(guiCurveDrawing.PixelToCurveSpace(pixelCoords, out curveCoords));
 }