Exemplo n.º 1
0
 private void SetMouseCommands(string obj)
 {
     var leftClickTrigger = new MouseButtonTrigger();
     leftClickTrigger.AddTag("temporary");
     var findEntityCommand = new Command(FindEntity2DOnPosition).Add(leftClickTrigger);
     findEntityCommand.AddTag("temporary");
     var moveMouse = new MousePositionTrigger(MouseButton.Left, State.Pressed);
     moveMouse.AddTag("temporary");
     var moveImageCommand =
         new Command(
             position =>
                 uiEditorScene.ControlProcessor.MoveImage(position, SelectedEntity2D, Adder.IsDragging,
                     uiEditorScene.IsSnappingToGrid, uiEditorScene)).Add(moveMouse);
     moveImageCommand.AddTag("temporary");
     var middleMouseClick = new MouseButtonTrigger(MouseButton.Middle);
     middleMouseClick.AddTag("temporary");
     var setLastPositionCommand =
         new Command(position => uiEditorScene.ControlProcessor.lastMousePosition = position).Add(
             middleMouseClick);
     setLastPositionCommand.AddTag("temporary");
     var releaseMiddleMouse = new MouseButtonTrigger(MouseButton.Left, State.Releasing);
     releaseMiddleMouse.AddTag("temporary");
     var setReleasingCommand =
         new Command(position => SetCommandsForReleasing(position)).Add(releaseMiddleMouse);
     setReleasingCommand.AddTag("temporary");
 }
Exemplo n.º 2
0
		public void SetMousePosition()
		{
			var middleClick = new MouseButtonTrigger();
			middleClick.AddTag("temporary");
			var setLastPositionCommand = new Command(position => SetPosition(position)).Add(middleClick);
			setLastPositionCommand.AddTag("temporary");
			var moveMouse = new MousePositionTrigger(MouseButton.Left, State.Released);
			moveMouse.AddTag("temporary");
			var checkTransformationCommand =
				new Command(position => CheckIfCanTransformControl(position)).Add(moveMouse);
			checkTransformationCommand.AddTag("temporary");
			var pressAndMoveMouse = new MousePositionTrigger(MouseButton.Left, State.Pressed);
			pressAndMoveMouse.AddTag("temporary");
			var pressOnControlCommand =
				new Command(position => TransformSelectedControl(position)).Add(pressAndMoveMouse);
			pressOnControlCommand.AddTag("temporary");
			var pressControl = new KeyTrigger(Key.LeftControl);
			pressControl.AddTag("temporary");
			var multiSelectControl = new Command(() => SetMultiSelection(true)).Add(pressControl);
			multiSelectControl.AddTag("temporary");
			var releaseControl = new KeyTrigger(Key.LeftControl, State.Releasing);
			releaseControl.AddTag("temporary");
			var disableMultiSelectControl =
				new Command(() => SetMultiSelection(false)).Add(releaseControl);
			disableMultiSelectControl.AddTag("temporary");
		}