public IControl CreateResizeControl(CanvasItem itemToResize, IUserInputReceiver parent, IEdgeSnappingEngine snappingEngine)
 {            
     return new ControlAdapter(new ResizeControl
            {
                CanvasItem = itemToResize, FrameOfReference = parent, SnappingEngine = snappingEngine
            });
 }
 public UIResizeOperationHandleConnector(ICanvasItem canvasItem, IUserInputReceiver parent, IEdgeSnappingEngine snappingEngine)
 {
     CanvasItem     = canvasItem;
     Parent         = parent;
     SnappingEngine = snappingEngine;
     Handles        = new Dictionary <IUserInputReceiver, IPoint>();
 }
        public Point GetMousePositionRelativeTo(IUserInputReceiver inputReceiver)
        {
            var mousePositionRelativeTo = Mouse.GetPosition((IInputElement)inputReceiver);
            var pclPoint = Mapper.Map <Point>(mousePositionRelativeTo);

            return(pclPoint);
        }
 public UIResizeOperationHandleConnector(ICanvasItem canvasItem, IUserInputReceiver parent, IEdgeSnappingEngine snappingEngine)
 {
     CanvasItem = canvasItem;
     Parent = parent;
     SnappingEngine = snappingEngine;
     Handles = new Dictionary<IUserInputReceiver, IPoint>();
 }
Example #5
0
 public IControl CreateResizeControl(CanvasItem itemToResize, IUserInputReceiver parent, IEdgeSnappingEngine snappingEngine)
 {
     return(new ControlAdapter(new ResizeControl
     {
         CanvasItem = itemToResize, FrameOfReference = parent, SnappingEngine = snappingEngine
     }));
 }
Example #6
0
        public void SetDragTarget(IUserInputReceiver hitTestReceiver, ICanvasItem itemToDrag)
        {
            if (this.dragRecordingScope != null)
            {
                throw new InvalidOperationException("There is already an active drag operation.");
            }

            this.ItemToDrag             = itemToDrag;
            hitTestReceiver.FingerDown += TargetOnPreviewMouseLeftButtonDown;
        }
Example #7
0
        private void SetupDragOperationHost(IUserInputReceiver movingControl)
        {
            DragOperationHost.SetDragTarget(movingControl, WrappedSelectedItems);

            var items = DesignSurface.Children;

            var allExceptTarget = items.Except(WrappedSelectedItems.Children);

            DragOperationHost.SnappingEngine.Magnets = allExceptTarget.ToList();
        }
        public void SetDragTarget(IUserInputReceiver hitTestReceiver, ICanvasItem itemToDrag)
        {
            if ( this.dragRecordingScope != null )
            {
                throw new InvalidOperationException("There is already an active drag operation.");         
            }

            this.ItemToDrag = itemToDrag;
            hitTestReceiver.FingerDown += TargetOnPreviewMouseLeftButtonDown;
        }
Example #9
0
 protected void OnFrameOfReferenceChanged(IUserInputReceiver oldFrameOfReference, IUserInputReceiver newFrameOfReference)
 {
     if (IsLoaded)
     {
         RegisterHandles();
     }
     else
     {
         Loaded += OnLoaded;
     }
 }
        public Point GetMousePositionRelativeTo(IUserInputReceiver inputReceiver)
        {
            var receiver = (UIElement)inputReceiver;
            var position = receiver
                           .TransformToVisual(Window.Current.Content)
                           .TransformPoint(new FoundationPoint());

            var finalPosition = new FoundationPoint(
                position.X + Window.Current.CoreWindow.PointerPosition.X,
                position.Y + Window.Current.CoreWindow.PointerPosition.Y
                );

            return(Mapper.Map <Point>(finalPosition));
        }
        public Point GetMousePositionRelativeTo(IUserInputReceiver inputReceiver)
        {
            
            var receiver = (UIElement) inputReceiver;
            var position = receiver
                .TransformToVisual(Window.Current.Content)
                .TransformPoint(new FoundationPoint());

            var finalPosition = new FoundationPoint(
                position.X + Window.Current.CoreWindow.PointerPosition.X, 
                position.Y + Window.Current.CoreWindow.PointerPosition.Y
                );

            return Mapper.Map<Point>(finalPosition);
        }
Example #12
0
 public UserKeyboardController(IUserInputReceiver receiver)
 {
     lastPressedKeys      = new List <Keys>();
     centralReceiver      = receiver;
     controllerKeyMapping = new Dictionary <Keys, Action> {
         { Keys.Down, centralReceiver.MoveDown },
         { Keys.Left, centralReceiver.MoveLeft },
         { Keys.Right, centralReceiver.MoveRight },
         { Keys.None, centralReceiver.MoveHorizontalIdle },
         { Keys.Up, centralReceiver.MoveUp },
         { Keys.X, centralReceiver.PerformAction },
         { Keys.R, centralReceiver.Reset },
         { Keys.A, centralReceiver.CharacterSwap },
     };
 }
Example #13
0
        public GamePadController(IUserInputReceiver receiver)
        {
            centralReceiver   = receiver;
            LeftStickMappings = new Dictionary <GamePadStickDirection, Action>
            {
                { GamePadStickDirection.Left, receiver.MoveLeft },
                { GamePadStickDirection.Right, receiver.MoveRight },
                { GamePadStickDirection.Up, receiver.MoveUp },
                { GamePadStickDirection.Down, receiver.MoveDown },
                { GamePadStickDirection.Center, receiver.MoveHorizontalIdle },
            };

            ButtonMappings = new Dictionary <GamePadButtons, Action>
            {
                { GamePadButtons.A, receiver.MoveUp },
                { GamePadButtons.B, receiver.PerformAction }
            };
        }
 protected void OnFrameOfReferenceChanged(IUserInputReceiver oldFrameOfReference,
     IUserInputReceiver newFrameOfReference)
 {
     
 }
 public IControl CreateResizeControl(CanvasItem itemToResize, IUserInputReceiver parent, IEdgeSnappingEngine snappingEngine)
 {
     return(new ControlAdapter(new ResizeControl(itemToResize, parent, snappingEngine)));
 }
 public DragOperationHost(IUserInputReceiver frameOfReference)
 {
     FrameOfReference = frameOfReference;        
     SnappingEngine = new NoEffectsCanvasItemSnappingEngine();
     IsDragging = false;
 }
Example #17
0
 protected void OnFrameOfReferenceChanged(IUserInputReceiver oldFrameOfReference,
                                          IUserInputReceiver newFrameOfReference)
 {
 }
Example #18
0
 public DragOperationHost(IUserInputReceiver frameOfReference)
 {
     FrameOfReference = frameOfReference;
     SnappingEngine   = new NoEffectsCanvasItemSnappingEngine();
     IsDragging       = false;
 }
 public IControl CreateResizeControl(CanvasItem itemToResize, IUserInputReceiver parent, IEdgeSnappingEngine snappingEngine)
 {
     return new ControlAdapter(new ResizeControl(itemToResize, parent, snappingEngine));
 }
 public void RegisterHandle(IUserInputReceiver handle, IPoint point)
 {
     Handles.Add(handle, point);
     handle.FingerDown += HandleOnMouseLeftButtonDown;
 }
 public Point GetPosition(IUserInputReceiver relativeTo)
 {
     return(ServiceLocator.InputProvider.GetMousePositionRelativeTo(relativeTo));
 }
Example #22
0
 public ResizeControl(ICanvasItem itemToResize, IUserInputReceiver parent, IEdgeSnappingEngine snappingEngine)
 {
     SnappingEngine   = snappingEngine;
     FrameOfReference = parent;
     CanvasItem       = itemToResize;
 }
        private void SetupDragOperationHost(IUserInputReceiver movingControl)
        {
            DragOperationHost.SetDragTarget(movingControl, WrappedSelectedItems);

            var items = DesignSurface.Children;

            var allExceptTarget = items.Except(WrappedSelectedItems.Children);

            DragOperationHost.SnappingEngine.Magnets = allExceptTarget.ToList();
        }
 public void RegisterHandle(IUserInputReceiver handle, IPoint point)
 {
     Handles.Add(handle, point);
     handle.FingerDown += HandleOnMouseLeftButtonDown;
 }
 protected void OnFrameOfReferenceChanged(IUserInputReceiver oldFrameOfReference, IUserInputReceiver newFrameOfReference)
 {
     if (IsLoaded)
     {
         RegisterHandles();
     }
     else
     {
         Loaded += OnLoaded;
     }
 }
 public Point GetMousePositionRelativeTo(IUserInputReceiver inputReceiver)
 {
     var mousePositionRelativeTo = Mouse.GetPosition((IInputElement)inputReceiver);
     var pclPoint = Mapper.Map<Point>(mousePositionRelativeTo);
     return pclPoint;
 }
 public Point GetPosition(IUserInputReceiver relativeTo)
 {
     return ServiceLocator.InputProvider.GetMousePositionRelativeTo(relativeTo);
 }
 public ResizeControl(ICanvasItem itemToResize, IUserInputReceiver parent, IEdgeSnappingEngine snappingEngine)
 {
     SnappingEngine = snappingEngine;
     FrameOfReference = parent;
     CanvasItem = itemToResize;
 }