Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snap for multiple connections enabled #158

Merged
merged 3 commits into from
Jan 16, 2024
Merged

Conversation

Tayebe79
Copy link
Member

Description

snap for multiple connections enabled

Fixes #155

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Tayebe79 Tayebe79 requested a review from l3enQ January 13, 2024 09:17
@Tayebe79 Tayebe79 self-assigned this Jan 13, 2024
Copy link
Contributor

@l3enQ l3enQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also please fix the issue with not snapping while creating node (either context menu or double click)?

@Tayebe79
Copy link
Member Author

can you also please fix the issue with not snapping while creating node (either context menu or double click)?

@l3enQ yes, it is now enabled

@Tayebe79 Tayebe79 requested a review from l3enQ January 14, 2024 07:02
Comment on lines 241 to 243
function snappedPosition (position) {
return Qt.vector2d(Math.ceil(position.x / 20) * 20, Math.ceil(position.y / 20) * 20);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we update this function so it snap to nearest grid not the next one?!
i.e., using round and not ceil

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also please check if we have the grid size some where like NLStyle or not!

node.guiConfig.position.x = Math.ceil(node.guiConfig.position.x / 20) * 20;
}
if(NLStyle.snapEnabled)
node.guiConfig.position = Qt.vector2d(Math.ceil(node.guiConfig.position.x / 20) * 20, Math.ceil(node.guiConfig.position.y / 20) * 20)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use the same function in scene?

@@ -121,6 +121,10 @@ Item {
if (obj?.objectType === NLSpec.ObjectType.Node) {
obj.guiConfig.position.x += deltaX;
obj.guiConfig.position.y += deltaY;

if(NLStyle.snapEnabled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use another style, so we just snap the top left position of this view not nodes! but let's keep it as you did

@Tayebe79
Copy link
Member Author

@l3enQ
Requested changes are made

Copy link
Contributor

@l3enQ l3enQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

@l3enQ l3enQ merged commit ea1dfae into main Jan 16, 2024
@l3enQ l3enQ deleted the snap-multiple-connections branch January 16, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snapping is not applied on multi nodes (Multi selected nodes)
2 participants