NodeGraphManagerViewModel.cs 1023 B

123456789101112131415161718192021222324252627282930
  1. using PixiEditor.AvaloniaUI.Models.Commands.Attributes.Commands;
  2. using PixiEditor.AvaloniaUI.Models.Handlers;
  3. using PixiEditor.Numerics;
  4. namespace PixiEditor.AvaloniaUI.ViewModels.SubViewModels;
  5. internal class NodeGraphManagerViewModel : SubViewModel<ViewModelMain>
  6. {
  7. public NodeGraphManagerViewModel(ViewModelMain owner) : base(owner)
  8. {
  9. }
  10. [Command.Internal("PixiEditor.NodeGraph.CreateNode")]
  11. public void CreateNode(Type nodeType)
  12. {
  13. Owner.DocumentManagerSubViewModel.ActiveDocument?.NodeGraph.CreateNode(nodeType);
  14. }
  15. [Command.Internal("PixiEditor.NodeGraph.ChangeNodePos")]
  16. public void ChangeNodePos((INodeHandler node, VecD newPos) args)
  17. {
  18. Owner.DocumentManagerSubViewModel.ActiveDocument?.NodeGraph.SetNodePosition(args.node, args.newPos);
  19. }
  20. [Command.Internal("PixiEditor.NodeGraph.EndChangeNodePos")]
  21. public void EndChangeNodePos()
  22. {
  23. Owner.DocumentManagerSubViewModel.ActiveDocument?.NodeGraph.EndChangeNodePosition();
  24. }
  25. }