public float ToCanvasSize(ICanvas canvas, IPositionable parentElement) { // FIXME: for now as x Vector2f leftBottom, rightTop; parentElement.GetBoundingBox(out leftBottom, out rightTop); Vector2f pixel = GuiVector2.PixelToCanvas(canvas, new Vector2f(this.pixelCoordinate, this.pixelCoordinate)); // We now construct canvas position. return(this.parentCoordinate * (rightTop - leftBottom).X + this.canvasCoordinate + pixel.X); }
/// <summary> /// The most common constructor. /// </summary> /// <param name="leftBottom"></param> /// <param name="rightTop"></param> /// <returns></returns> public static GuiRect CreateRectangle(GuiVector2 leftBottom, GuiVector2 rightTop) { return(new GuiRect(RectangleMode.MinMax, leftBottom, rightTop)); }
/// <summary> /// Creates a rectangle. /// </summary> public GuiRect(RectangleMode mode, GuiVector2 arg1, GuiVector2 arg2) { this.mode = mode; this.arg1 = arg1; this.arg2 = arg2; }