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

Apply Snap-to-grid of drawing items not on their center position #3465

Closed
b-ehlers opened this issue Apr 25, 2023 · 0 comments
Closed

Apply Snap-to-grid of drawing items not on their center position #3465

b-ehlers opened this issue Apr 25, 2023 · 0 comments
Milestone

Comments

@b-ehlers
Copy link

Currently, when snap-to-grid is active, all items are snapped to their center position. For node item this is fine, as the links are starting at the center of the node. So even with differently sized nodes it is easy to position them in a way, that the links are horizontally or vertically aligned.

But for the other item types the center is nothing special, the user is more interested in the position of an edge. I'm always irritated, that the item position slightly changes, when I resize it. So I suggest to snap drawing items to the upper left edge. Maybe the circle/elliptic item could be an exception, but I won't implement a special case just for that.

But this will slightly change the position of drawing items of existing projects (when snap-to-grid is active). Therefore I won't change that in v2.2.

Describe the solution you'd like

I suggest to change the snap-to-gid part in gns3/items/drawing_item.py so, that it snaps to the upper left edge:

        if change == QtWidgets.QGraphicsItem.ItemPositionChange and self._main_window.uiSnapToGridAction.isChecked():
            grid_size = self._graphics_view.drawingGridSize()
            value.setX(grid_size * round(value.x() / grid_size))
            value.setY(grid_size * round(value.y() / grid_size))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants