Coder Social home page Coder Social logo

Comments (11)

franciswillian91 avatar franciswillian91 commented on May 18, 2024 1

same problem here, i need to save node locations after dragging and arranging my flow but i don't know how to get those properties once done.
@taylien96 you mentioned that there is a way to do this but i didn't find it.

from svelvet.

sher85 avatar sher85 commented on May 18, 2024

@ak4zh where are you experiencing this issue, REPL on the selvet.io website? Can you share a screenshot/gif?

from svelvet.

ak4zh avatar ak4zh commented on May 18, 2024

I want to get the new co-ordinates of the nodes so I can save it in a store and render the samediagram again which user created by dragging the nodes.
I did not find any info about getting the x,y coordinates of the node once it has been dragged by the user.

from svelvet.

ronvoluted avatar ronvoluted commented on May 18, 2024

Looks like Svelvet doesn't support doing this but you can modify one line in node_modules to enable it:

# ./node_modules/svelvet/Nodes/index.svelte#L46

-    if (!moved && node.id == $nodeIdSelected) {
+    if (node.id == $nodeIdSelected) {

Then you can use the clickCallback property:

const handleDrag = (node: Node): void => {
  $positions[node.id] = node.position;
}

const nodes = [
  {
    id: 1,
    width: 100,
    height: 100,
    position: { x: 0, y: 250 },
    data: { label: 'Drag me to save position in Svelte store' },
    clickCallback: handleDrag,
  },
];

from svelvet.

pbxothi avatar pbxothi commented on May 18, 2024

@ronvoluted thanks for the quick fix. This is useful. However, the callback is not triggered when dragged on a touch screen.

from svelvet.

taylien96 avatar taylien96 commented on May 18, 2024

There is now a way to get the json and upload it with an updated diagram to share changes between users!
Not closed as it's not exactly what you described but we think it may serve your purposes for now.

from svelvet.

gurmeet-bluesheets avatar gurmeet-bluesheets commented on May 18, 2024

@franciswillian91 I think @taylien96 is referring to this https://www.svelvet.io/docs/importDiagrams/

from svelvet.

gurmeet-bluesheets avatar gurmeet-bluesheets commented on May 18, 2024

@taylien96 how to handle this in the latest version? We simply cannot ask the users to download and re-upload files. @ronvoluted can you help?

from svelvet.

franciswillian91 avatar franciswillian91 commented on May 18, 2024

@gurmeet-bluesheets, sure makes sense i didn't discover that feature, mb ;D

from svelvet.

rungdung avatar rungdung commented on May 18, 2024

Indeed, I would like a built in way to persist diagrams or documentation on how to retrieve it from the store

from svelvet.

briangregoryholmes avatar briangregoryholmes commented on May 18, 2024

Closing as this has fundamentally changed in Svelvet v7 and up. That said, smoothing out the DX is an active area for us. The position prop can be "bound" to using bind:position for programatic read/write access.

from svelvet.

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.