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.

Have a toggle between the old snapGrid and the new one

See original GitHub issue

Please describe the feature that you want to propose

I would like a toggle between the old snapGrid and the new one. I was using the old one in my code and with this update it broke everything. I understand why users would like the snapGrid[10, 10] to move in increments of 10 based off of 0, 0. But I also like the idea of moving over 545 for where it is now, but snapGrid[545, 30] now does it in reference to 0, 0. That is what I use in my code. If things are not aligned at 0, 0. it completely throws off the dragging feature. I have made a temporary fix :

const handleDragStart = (node, event) => {
// 545 is what the snapGrid is set to and where the node goes to on drag
     if (node.position.x == 545){
         // 625 is the actual node.position.x that I want it to be at. 
         node.position.x = 625
      }
 }

This is temporary and only works for some of my nodes. I hope that this feature can be created so I don’t have to look into a more permanent fix. I believe that the toggle could look something like: snapGridAtZero={true/false}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
moklickcommented, Oct 10, 2022

@WillBaker2017 I don’t like it 😄 The old version was broken, because it was not one grid but multiple ones. If you want a special snap behaviour you can use onNodesChange or alter nodes when dragging is false for example.

0reactions
WillBaker2017commented, Sep 28, 2022

@moklick We could allow switching between snapping modes by allowing more values for the snapToGrid boolean. So change

https://github.com/wbkd/react-flow/blob/7a909e942527daecb01fb78a4cfc00d5f46330ab/src/types/component-props.ts#L95

to snapToGrid?: boolean | 'absolute' | 'relative' to avoid breaking changes.

@wardoost @moklick I like that a lot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting snap grid spacings - Custom IC Design
Hi, I am using a skill function to redefine my X and Y snap spacings - because using "e" and filling in the...
Read more >
Working with the Cursor-Snap System in Altium Designer
Select View » Toggle Units (or press the Q shortcut) to switch the design space units between imperial and metric. The current Snap...
Read more >
snap,grid, ortho mode, polar tracking, object snap ... - YouTube
Learn AutoCAD for free using this step-by-step AutoCAD tutorial series containing nearly 40 videos with lesson files ...
Read more >
Grids and Units | Online Documentation for Altium Products
Altium TechDocs are online documentation for Altium products, providing the basic information you need to get the most out of our tools.
Read more >
Right-Suite® Universal: New Features - Wrightsoft
RSU® is the #1 HVAC load calculation and duct design software to help HVAC ... An option has been added to the “Options”...
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