Beispiel #1
0
        internal override RadRect GetPosition()
        {
            // TODO: Consider better interpretation of segments in cartesian coordinates.
            var centerR   = this.Radius / 2;
            var centerAng = this.startAngle % 360 + this.SweepAngle / 2;

            var point = RadMath.ToCartesianCoordinates(centerR, centerAng);

            return(new RadRect(this.CenterPoint.X + point.X, this.CenterPoint.Y + point.Y, 1, 1));
        }
Beispiel #2
0
        private void ArrangeMenuItemControl(RadialSegment segmentModel)
        {
            var centerPointPolar      = CoordinatesUtils.GetCenterPosition(segmentModel.LayoutSlot);
            var centerPoint           = RadMath.ToCartesianCoordinates(centerPointPolar.Radius, centerPointPolar.Angle);
            var tranformedCenterPoint = new Point(centerPoint.X + this.Model.OuterRadius, this.Model.OuterRadius - centerPoint.Y);

            var element = segmentModel.Visual as RadialMenuItemControl;

            element.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

            var arrangeSlot = new Rect(tranformedCenterPoint.X - element.DesiredSize.Width / 2.0, tranformedCenterPoint.Y - element.DesiredSize.Height / 2.0, element.DesiredSize.Width, element.DesiredSize.Height);

            element.Arrange(arrangeSlot);
            Canvas.SetLeft(element, arrangeSlot.X);
            Canvas.SetTop(element, arrangeSlot.Y);
        }