Giter Site home page Giter Site logo

wieslawsoltes / nodeeditor Goto Github PK

View Code? Open in Web Editor NEW
116.0 6.0 25.0 520.62 MB

A node editor control for Avalonia.

License: MIT License

C# 95.24% PowerShell 2.59% Shell 1.99% Batchfile 0.18%
avalonia avaloniaui node-editor graph graph-control logic-diagram

nodeeditor's Introduction

NodeEditor

Build Status CI

NuGet NuGet

A node editor control for Avalonia.

About

The node editor is an Avalonia control for editing and rendering nodes and connectors. Node contents can be defined from xaml. Node controls, connectors and pins can be retemplated from xaml or used with the provided default theme. The contents of the nodes are rendered based on provided view models. The default implementation of the view models is done using ReactiveUI, users can create their own view models based on core model interfaces. The node contents are resolved using the provided object type by view locator.

image

Building NodeEditor

First, clone the repository or download the latest zip.

git clone https://github.com/wieslawsoltes/NodeEditor.git

Build on Windows using script

Open up a command-prompt and execute the commands:

.\build.ps1

Build on Linux using script

Open up a terminal prompt and execute the commands:

./build.sh

Build on OSX using script

Open up a terminal prompt and execute the commands:

./build.sh

Web

git clone https://github.com/wieslawsoltes/NodeEditor.git
dotnet workload install wasm-tools
dotnet run --project ./samples/NodeEditor.Web/NodeEditor.Web.csproj -c Release

NuGet

NodeEditor is delivered as a NuGet package.

You can find the packages here NuGet and install the package like this:

Install-Package NodeEditorAvalonia

Available Packages

Package Sources

Resources

License

NodeEditor is licensed under the MIT license.

nodeeditor's People

Contributors

mrxx99 avatar wieslawsoltes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nodeeditor's Issues

Some feedback on making this general purpose graph control

This is amazing, was able to create very quickly a good-looking graph-based window for my project (image below).
I think can made into a package as a graph control by letting the user set the content of each Node and Connector and customize them.
Few things I noticed when combining it with my implementation -

1. Check whether the node was moved and if so handle the event in NodeDragBehavior

  1. Allow setting content of a node, possibly by having DataTemplates in DrawingNodeView or just add content property in the node object (not sure about this).

Not sure what are your plans with this, if you'd like I can make these changes as I already work on them in my project.

image

Thanks!

Allow undo/redo

Support undoing the last change or redoing the last undo.
Either through API or hotkeys - Ctrl+Z, Ctrl+Y

Drop nodes on mouse position

I have resized my canvas to 10000x7500, when I drop nodes on it the nodes are hided in the lower right corner. So it would be a great improvement to drop the node where the mouse position is

Node resizing

Resize is noted as "todo". Can this be added at some point? Thanks

Allow dynamic size of nodes

Currently (from my understanding) you need to set static height/width for each node and their Pins.
This is OK for the start but, at least in my scenario each node will have different size depending on user input.
I am sure I can just change these properties as I get user input, but it would be less optimal.
Thanks!

Material Design theme

Hey I love this project!

Would you consider making a theme for material design instead of fluent?

setters on interfaces

Most (all?) of the properties on the interfaces in NodeEditorAvalonia.Model have public setters.

Would it be possible to remove those setters, unless it is required for NodeEditor's operation?

For example:

  • I want my implementations of INodeTemplate to be immutable; it doesn't make sense to change the "Line" tool's name to "Circle"
  • I don't want public consumers of my IEditor to be able to add templates. I may, in my own internal model, have a method to add templates, but I don't want anyone to be able to do it.

I can implement the interface explicitly, and throw a NotSupportedException if someone calls the setters - but I would rather not do this.

How to compile and run Web version locally?

Hi @wieslawsoltes,

First of all, thank you so much for this reference code to learn how to compile an Avalonia app for WebAssemly.

I'm trying to execute the Web version locally. I cloned the repo and I'm trying to execute it locally. I tried the following:

\samples\NodeEditor.Web>dotnet build
\samples\NodeEditor.Web>dotnet run

Then, I'm able to connect to http://localhost:5000, but I'm getting the following:
image

Am I missing something? Thank you!

Add Non Removable Nodes

Like for example to ensure that Exit/Entry nodes are present enable to prevent from deleting it

(Jetbrains Rider) Unable to cast object of type RectangleViewModel to type INode

How to reproduce:

  1. Download/clone repo
  2. Open NodeEditor.sln with Jetbrains Rider (with Visual Studio not reproducible)
  3. Run Debug NodeEditor.Desktop

I can't figure out what the difference is between Rider and VS. I am currently in the process of researching the issue.

It throws exception on public static void Main, class Program.cs, line 10

System.InvalidCastException: Unable to cast object of type 'NodeEditorDemo.ViewModels.Nodes.RectangleViewModel' to type 'NodeEditor.Model.INode'.
at CompiledAvaloniaXaml.XamlIlHelpers.NodeEditor.Model.INode,NodeEditorAvalonia.Model.Content!Getter(Object)
at Avalonia.Data.Core.ClrPropertyInfo.Get(Object target) in //src/Avalonia.Base/Data/Core/ClrPropertyInfo.cs:line 27
at Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.InpcPropertyAccessor.get_Value() in /
/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/PropertyInfoAccessorFactory.cs:line 88
at Avalonia.Markup.Xaml.MarkupExtensions.CompiledBindings.InpcPropertyAccessor.SendCurrentValue() in /_/src/Markup/Avalonia.Markup.Xaml/MarkupExtensions/CompiledBindings/PropertyInfoAccessorFactory.cs:line 132

Hanging up in WASM/mobile builds?

We tried adding the node editor into a new Avalonia template but it keeps stalling/hanging before the splash screen & page load. And I figured this is likely due to some kind of mismatch or incompatibility of versions. Anyone else had this issue or know how to point us in the right direction? We were using the last 11.0.0 preview

Add a check for dependencies in windows build script

Description

When running the build script on windows, the restore and compile tasks fail if wasm-tools or any other dependency isn't already installed because there is no check for that.

To Reproduce:

  1. Dont have wasm-tools installed on the machine
  2. Run build.cmd/build.ps1

How to resolve

Include a check for dependencies in the build script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.