Example #1
0
            public override IGripManipulationHandle[] GetGrips(double pageScale, int gripLevel)
            {
                if (gripLevel <= 1)
                {
                    var ls     = (ClosedCardinalSpline)_hitobject;
                    var pts    = new PointF[ls._curvePoints.Count];
                    var offset = ls.Location.AbsoluteVectorPivotToLeftUpper;
                    for (int i = 0; i < pts.Length; i++)
                    {
                        pts[i] = (PointF)(ls._curvePoints[i] + offset);
                        var pt = ls._transformation.TransformPoint(pts[i]);
                        pt     = Transformation.TransformPoint(pt);
                        pts[i] = pt;
                    }

                    var grips = new IGripManipulationHandle[gripLevel == 0 ? 1 : 1 + ls._curvePoints.Count];

                    // Translation grips
                    var path = new GraphicsPath();
                    path.AddClosedCurve(pts, (float)ls._tension);
                    path.Widen(new Pen(Color.Black, (float)(6 / pageScale)));
                    grips[grips.Length - 1] = new MovementGripHandle(this, path, null);

                    // PathNode grips
                    if (gripLevel == 1)
                    {
                        float gripRadius = (float)(3 / pageScale);
                        for (int i = 0; i < ls._curvePoints.Count; i++)
                        {
                            grips[i] = new ClosedCardinalSplinePathNodeGripHandle(this, i, pts[i], gripRadius);
                        }
                    }
                    return(grips);
                }
                else
                {
                    return(base.GetGrips(pageScale, gripLevel));
                }
            }
Example #2
0
			public override IGripManipulationHandle[] GetGrips(double pageScale, int gripLevel)
			{
				if (gripLevel <= 1)
				{
					ClosedCardinalSpline ls = (ClosedCardinalSpline)_hitobject;
					PointF[] pts = new PointF[ls._curvePoints.Count];
					var offset = ls.Location.AbsoluteVectorPivotToLeftUpper;
					for (int i = 0; i < pts.Length; i++)
					{
						pts[i] = (PointF)(ls._curvePoints[i] + offset);
						var pt = ls._transformation.TransformPoint(pts[i]);
						pt = this.Transformation.TransformPoint(pt);
						pts[i] = pt;
					}

					IGripManipulationHandle[] grips = new IGripManipulationHandle[gripLevel == 0 ? 1 : 1 + ls._curvePoints.Count];

					// Translation grips
					GraphicsPath path = new GraphicsPath();
					path.AddClosedCurve(pts, (float)ls._tension);
					path.Widen(new Pen(Color.Black, (float)(6 / pageScale)));
					grips[grips.Length - 1] = new MovementGripHandle(this, path, null);

					// PathNode grips
					if (gripLevel == 1)
					{
						float gripRadius = (float)(3 / pageScale);
						for (int i = 0; i < ls._curvePoints.Count; i++)
						{
							grips[i] = new ClosedCardinalSplinePathNodeGripHandle(this, i, pts[i], gripRadius);
						}
					}
					return grips;
				}
				else
				{
					return base.GetGrips(pageScale, gripLevel);
				}
			}