Пример #1
0
        public Vector2f ToConvasPosition(ICanvas canvas, IPositionable parentElement)
        {
            Vector2f leftBottom, rightTop;

            parentElement.GetBoundingBox(out leftBottom, out rightTop);

            // We now construct canvas position.
            return(leftBottom + Vector2f.ComponentMultiply(parentCoordinates, (rightTop - leftBottom)) +
                   canvasCoordinates + PixelToCanvas(canvas, pixelCoordinates));
        }
Пример #2
0
        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);
        }