Git Product home page Git Product logo

Comments (4)

nabil6391 avatar nabil6391 commented on May 12, 2024

Thanks @waj334

Its an interesting concept, would you be able to give me a working gist so that I can test and correct the implementation

from graphview.

waj334 avatar waj334 commented on May 12, 2024

I doubt you'd need the whole implementation of my drag and drop, so you could probably replicate the behavior by just adding a node from the onDragStart function on a Draggable and removing it in onDragCompleted.

I think for my use case though, I want to not have the nodes automatically positioned so that I can allow the user to place them where ever they want. I assume I need a custom Layout that just does nothing?

from graphview.

waj334 avatar waj334 commented on May 12, 2024

I called right. Using a Layout that does nothing is exactly what I wanted.

class DumbGraphAlgorithm implements Layout {
DumbGraphAlgorithm({this.renderer}) {
renderer = renderer ?? ArrowEdgeRenderer();
}

@OverRide
EdgeRenderer renderer;

@OverRide
Size run(Graph graph, double shiftX, double shiftY) {
return calculateGraphSize(graph);
}

@OverRide
void setFocusedNode(Node node) {
//Do nothing
}

Size calculateGraphSize(Graph graph) {
var left = double.infinity;
var top = double.infinity;
var right = double.negativeInfinity;
var bottom = double.negativeInfinity;

graph.nodes.forEach((node) {
  left = min(left, node.x);
  top = min(top, node.y);
  right = max(right, node.x + node.width);
  bottom = max(bottom, node.y + node.height);
});

return Size(right - left, bottom - top);

}
}

from graphview.

nabil6391 avatar nabil6391 commented on May 12, 2024

Nice

from graphview.

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.