public void Recalculate(ElementPosition element, ElementPosition parentPosition)
 {
     element.Center = new Vector2(
         this.anchor.Position.Center.X + (this.anchor.Position.Size.X + this.marginX) * this.xPortionAnchor / 2 - element.Size.X * this.xPortionThis / 2,
         this.anchor.Position.Center.Y + (this.anchor.Position.Size.Y + this.marginY) * this.yPortionAnchor / 2 - element.Size.Y * this.yPortionThis / 2
         );
 }
            public void Recalculate(ElementPosition element, ElementPosition parentPosition)
            {
                var widthDelta = this.anchor.Position.Center.X + xPortionAnchor * (this.anchor.Position.Size.X / 2 - this.marginX) -
                                 (element.Center.X + element.Size.X / 2);

                element.Center = new Vector2(element.Center.X + widthDelta / 2, element.Center.Y);
                element.Size   = new Vector2(element.Size.X + widthDelta, element.Size.Y);
            }
 public RelativeToPositioner(ElementPosition anchor, float xPortionAnchor, float yPortionAnchor, float xPortionThis, float yPortionThis)
 {
     this.anchor         = anchor;
     this.xPortionAnchor = xPortionAnchor;
     this.yPortionAnchor = yPortionAnchor;
     this.xPortionThis   = xPortionThis;
     this.yPortionThis   = yPortionThis;
 }
            public void Recalculate(ElementPosition element, ElementPosition parentPosition)
            {
                var leftBound  = -parentPosition.Size.X / 2 + this.parentMargin;
                var rigthBound = Math.Max(parentPosition.Size.X / 2 - this.parentMargin - element.Size.X / 2, leftBound);

                element.Center = new Vector2(
                    Methods.Clamp(this.sourcePoint.X + element.Size.X / 2, leftBound, rigthBound) + parentPosition.Center.X,
                    this.sourcePoint.Y + element.Size.Y / 2 + this.sourceMargin
                    );
            }
            public void Recalculate(ElementPosition element, ElementPosition parentPosition)
            {
                float windowX = parentPosition.Size.X / 2 - marginX - element.Size.X / 2;
                float windowY = parentPosition.Size.Y / 2 - marginY - element.Size.Y / 2;

                element.Center = new Vector2(
                    windowX * this.xPortion + parentPosition.Center.X,
                    windowY * this.yPortion + parentPosition.Center.Y
                    );
            }
        public void Recalculate(ElementPosition parentPosition)
        {
            foreach (var positioner in this.positioners)
            {
                positioner.Recalculate(this, parentPosition);
            }

            if (parentPosition != null)
            {
                this.ClipArea = new ClipWindow(this.Center, this.Size, parentPosition.ClipArea);
            }
            else
            {
                this.ClipArea = new ClipWindow(this.Center, this.Size);
            }
        }
            public void Recalculate(ElementPosition element, ElementPosition parentPosition)
            {
                var leftBound  = -parentPosition.Size.X / 2 + this.parentMargin;
                var rigthBound = Math.Max(parentPosition.Size.X / 2 - this.parentMargin - element.Size.X / 2, leftBound);

                var centerX   = Methods.Clamp(this.sourcePoint.X + element.Size.X / 2, leftBound, rigthBound) + parentPosition.Center.X;
                var centerUpY = this.sourcePoint.Y + element.Size.Y / 2 + this.sourceMargin;

                if (centerUpY - parentPosition.Center.Y + element.Size.Y / 2 <= parentPosition.Size.Y / 2)
                {
                    element.Center = new Vector2(centerX, centerUpY);
                }
                else
                {
                    element.Center = new Vector2(centerX, this.sourcePoint.Y - element.Size.Y / 2 - this.sourceMargin);
                }
            }
 public void Recalculate(ElementPosition element, ElementPosition parentPosition)
 {
     element.Size = element.contentSize() + new Vector2(this.paddingX, this.paddingY);
 }
 public void Recalculate(ElementPosition element, ElementPosition parentPosition)
 {
     element.Center += this.offset;
 }
Exemple #10
0
 public void Detach()
 {
     this.parentPosition.OnReposition -= this.Recalculate;
     this.parentPosition = null;
 }
Exemple #11
0
 public virtual void Attach(IGuispaceElement parent)
 {
     this.parentPosition = parent.Position;
     this.parentPosition.OnReposition += this.Recalculate;
 }
Exemple #12
0
 private void dependsOn(ElementPosition dependency)
 {
     dependency.OnReposition -= this.Recalculate;
     dependency.OnReposition += this.Recalculate;
 }
 public StretchRightToPositioner(ElementPosition anchor, float xPortionAnchor, float marginX)
 {
     this.anchor         = anchor;
     this.xPortionAnchor = xPortionAnchor;
     this.marginX        = marginX;
 }
Exemple #14
0
 public WrapPosition(ElementPosition original, IWrapPositioner positioner)
 {
     this.Then       = original;
     this.positioner = positioner;
 }