public static IMouseDataSource BindLocalDragger(
     this IMouseDataSource source, ILocalDragger <Point> dragger)
 {
     source.MouseMoved += dragger.NewPoint;
     dragger.NewPoint(MouseMessageType.Down, source.InitialPoint);
     return(source);
 }
Beispiel #2
0
 public KeySwitcherDragger(IKeyboardQuery keyboard, ModifierKeys activatingKeys,
                           ILocalDragger <T> pressedTarget, ILocalDragger <T> defaultTarget)
 {
     this.keyboard       = keyboard;
     this.pressedTarget  = pressedTarget;
     this.defaultTarget  = defaultTarget;
     this.activatingKeys = activatingKeys;
 }
Beispiel #3
0
 public static ILocalDragger <Point> RectToCircle(
     Point origin, ILocalDragger <CircularPoint> target) =>
 RectToCircle(origin, new Vector(1, 0), target);
Beispiel #4
0
 public MouseUpCircleSnapper(int numPoints, double width, ILocalDragger <CircularPoint> target) :
     base(numPoints, width, target)
 {
 }
Beispiel #5
0
 private static ILocalDragger <Point> FieldDragger(
     IKeyboardQuery keyboard, Point initialPoint, ILocalDragger <Point> target) =>
 InitialPoint(initialPoint,
              OnKey(keyboard, ModifierKeys.Shift, i => new RestrictToAxis(i),
                    OnKey(keyboard, ModifierKeys.Alt, i => GridSnapping(5, i), target)));
Beispiel #6
0
 private static ILocalDragger <Point> FieldDragger(Point initialPoint, ILocalDragger <Point> target) =>
 FieldDragger(new KeyboardQuery(), initialPoint, target);
Beispiel #7
0
 public static ILocalDragger <T> OnKey <T>(
     ModifierKeys modifier, Func <ILocalDragger <T>, ILocalDragger <T> > whenPressed,
     ILocalDragger <T> unpressed) where T : struct =>
 OnKey <T>(new KeyboardQuery(), modifier, whenPressed, unpressed);
Beispiel #8
0
 public static ILocalDragger <Point> InitialPoint(Point origin, ILocalDragger <Point> target) =>
 new InitialPointDragger(origin, target);
Beispiel #9
0
 public static ILocalDragger <Point> Delta(ILocalDragger <Point> target) =>
 new DeltaDragger(target);
 public InitialPointDragger(Point origin, ILocalDragger <Point> target)
 {
     this.origin = origin;
     this.target = target;
 }
Beispiel #11
0
 public RestrictToAxis(ILocalDragger <Point> target)
 {
     this.target = target;
 }
Beispiel #12
0
 public UndoDragger(IUndoEngine undo, ILocalDragger <T> effector)
 {
     this.undo     = undo;
     this.effector = effector;
 }
 public MinimumDragger(double radius, ILocalDragger <Point> effector)
 {
     radiusSquared = radius * radius;
     this.effector = effector;
 }
Beispiel #14
0
 public static ILocalDragger <Point> RectToCircle(
     Point origin, Vector zero, ILocalDragger <CircularPoint> target) =>
 Action((type, pt) => target.NewPoint(type, CircularPoint.FromVectors(zero, pt - origin)));
Beispiel #15
0
 public DeltaDragger(ILocalDragger <Point> target)
 {
     this.target = target;
 }
Beispiel #16
0
 public static ILocalDragger <CircularPoint> SnapMouseUpToAngle(
     int snapPoints, double width, ILocalDragger <CircularPoint> target) =>
 new MouseUpCircleSnapper(snapPoints, width, target);
Beispiel #17
0
 public static ILocalDragger <Point> ConstrainToUnitSquare(ILocalDragger <Point> target) =>
 Constrain(new Rect(0, 0, 1, 1), target);
Beispiel #18
0
 public static ILocalDragger <Point> InitialPoint(
     double iX, double iY, ILocalDragger <Point> target) => InitialPoint(new Point(iX, iY), target);
Beispiel #19
0
 public static ILocalDragger <Point> Constrain(Rect bounds, ILocalDragger <Point> target) =>
 Transform(pt => bounds.ApplyConstraint(pt), target);
Beispiel #20
0
 public static ILocalDragger <Point> GridSnapping(double snapSize, ILocalDragger <Point> target) =>
 Action((type, point) => target.NewPoint(type,
                                         new Point(SnapToGrid(snapSize, point.X), SnapToGrid(snapSize, point.Y))));
Beispiel #21
0
 public static ILocalDragger <T> Undo <T>(IUndoEngine undo, ILocalDragger <T> effector)
     where T : struct =>
 new UndoDragger <T>(undo, effector);
Beispiel #22
0
 public static ILocalDragger <T> OnKey <T>(IKeyboardQuery keyboard,
                                           ModifierKeys modifier, Func <ILocalDragger <T>, ILocalDragger <T> > whenPressed,
                                           ILocalDragger <T> unpressed) where T : struct =>
 new KeySwitcherDragger <T>(keyboard, modifier, whenPressed(unpressed), unpressed);
Beispiel #23
0
 public static ILocalDragger <Point> MinimumDrag(ILocalDragger <Point> effector) =>
 MinimumDrag(SystemParameters.MinimumVerticalDragDistance, effector);
Beispiel #24
0
 public static ILocalDragger <Point> FieldDragger(IKeyboardQuery keyboard,
                                                  double initialX, double initialY, ILocalDragger <Point> target) =>
 FieldDragger(keyboard, new Point(initialX, initialY), target);
Beispiel #25
0
 public static ILocalDragger <Point> MinimumDrag(double radius, ILocalDragger <Point> effector) =>
 new MinimumDragger(radius, effector);
Beispiel #26
0
 public static ILocalDragger <Point> Constrain(
     double minX, double maxX, double minY, double maxY, ILocalDragger <Point> target) =>
 Constrain(new Rect(new Point(minX, minY), new Point(maxX, maxY)), target);
Beispiel #27
0
 public CircleSnapper(int numPoints, double width, ILocalDragger <CircularPoint> target)
 {
     this.target = target;
     anchors     = ComputeAnchors(numPoints);
     halfWidth   = width / 2;
 }