question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recording nodes being moved

See original GitHub issue

Like a few other people I’m trying to store node positions. I’ve done a hack using the MouseUp, but this affecting the performance of a few other things and I’d really like to try and use events.

I’ve found lots of posts that suggest:

You can subscribe to actionStartedFiring/actionStillFiring, and it will fire MoveItemsAction where you can access moved items from action.selectionModels

But no code to show how this works

i.e. in this code, all of these events work

    this.diagramModel = new DiagramModel()
    this.diagramModel.addListener({
      linksUpdated:   this.onUpdateLinks.bind(this),
      offsetUpdated:  _.debounce(this.updateOffset.bind(this),500),
      zoomUpdated:    this.updateZoom.bind(this),
      actionStillFiring: (a) => console.log(a),
    })

But actionStartedFiring/actionStillFiring are never called, MoveItemsAction is never called… I just can’t find any way of listening for nodes being moved.

Please can someone give me some example code to show how this works?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JokerNNcommented, Oct 2, 2018

Ah ok, I looked into implementation and you need to return true from actionStartedFiring listener.

https://github.com/projectstorm/react-diagrams/blob/fa34f5c98b42eb4b6770a64d9d06373cc153e4c6/src/widgets/DiagramWidget.tsx#L200

1reaction
JokerNNcommented, Sep 20, 2018

Hi, thanks for this research and you are almost there!

The thing is that actionStartedFiring/actionStillFiring are widget events, not model, so apropriate usage will be like this

<DiagramWidget
    {...props}
    actionStartedFiring={this.onDiagramActionStarted}
    actionStoppedFiring={this.onDiagramActionStopped}
/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems when developing message flows with file nodes - IBM
This problem can be caused when the FileInput node cannot move files from its input directory to the archive or backout directory because...
Read more >
How I can move record to another collection? - Stack Overflow
Currently, I have a lot of records that need to be moved to another collection. I try with aggregate with $out operator, but...
Read more >
Reorder and refine nodes - NVivo for Mac Help
Watch a video tutorial; Sort nodes; Copy nodes; Move nodes to a new parent or folder; Reorder nodes (within the same level of...
Read more >
Move Node - Bentley - Product Documentation
To move an existing node: ... Click the Edit Datum button . Click on the node to be moved and click the Move...
Read more >
Recording and playing back data — ROS 2 Documentation
In the topics tutorial, you learned that the /turtle_teleop node publishes ... Use the arrow keys to move the turtle around, and you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found