Giter VIP home page Giter VIP logo

Comments (5)

miroiu avatar miroiu commented on June 2, 2024 1

I created the PR. Relevant files are (EditorView.xaml, EditorView.xaml.cs, NodifyEditor.cs).

Please let me know if this helps.

drag-drop

from nodify.

jpk6789 avatar jpk6789 commented on June 2, 2024 1

Thank you very much for your quick response and for the PR. I looked into it and I think I understand it and can adapt it to my case. I will also try to use the DragOver event but this seems to be straightforward. I will update you with the progress.

P.S.: Yes, I use the NuGet package and have no direct access to the source code. This was the reason for my question.

from nodify.

jpk6789 avatar jpk6789 commented on June 2, 2024 1

Hi,
as said, here is the update: It works :) I also have implemented the DtagOver preview and everything with control of the respective viewmodels. Thanks again for this awesome library and your support.

grafik

from nodify.

miroiu avatar miroiu commented on June 2, 2024

Hi! It should be pretty straight forward to implement using the DragDrop API provided by WPF.

The only issue I see is that the NodifyEditor.MouseLocation - which could be used to position the dropped node - may stop updating due to MouseMove events not firing anymore while dragging. To workaround this, create a subclass of NodifyEditor which exposes a method to get the coordinates inside the editor (graph) space and use it in the drop event handler to position the node (assuming you use the nuget package and don't have access to the source code, otherwise you can add this method to the NodifyEditor itself).

internal class CustomEditor : NodifyEditor
{
    /// <summary>
    /// Translates the event location to graph space coordinates (relative to the <see cref="ItemsHost" />).
    /// </summary>
    /// <param name="args">The drag event.</param>
    /// <returns>A location inside the graph</returns>
    public Point GetLocationInsideEditor(DragEventArgs args)
        => args.GetPosition(ItemsHost);
}

Depending on your requirements, you can also show a preview of the node you drag using the DragOver event.

I'll create a simple example and link it to this issue. Do you have any progress on this, any specific questions?

from nodify.

miroiu avatar miroiu commented on June 2, 2024

Hi, thanks for the kind words and for the update. It's really cool that you also implemented the drag over preview. 🙂

from nodify.

Related Issues (20)

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.