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

Snapping and vertex tool not working with some layers if snapping was enabled when loaded #33449

Closed
borysiasty opened this issue Dec 17, 2019 · 4 comments
Assignees
Milestone

Comments

@borysiasty
Copy link
Member

@borysiasty borysiasty commented Dec 17, 2019

It's a regression between 3.10 and 3.11/master.

With snapping enabled, if I open either:

  • an empty PostGIS layer
  • a memory layer without any attributes

and add any features, snapping doesn't work, what makes also the vertex tool unable to find and highlight any feature.

Steps to reproduce

  1. Ensure the snapping is ON during steps 1 and 2.
  2. Either open an empty PostGIS layer, or a new memory layer without any fields
  3. Add any feature
  4. Try to edit vertices - doesn't work
  5. Try to save changes, re-enter the edit mode etc - nothing helps
  6. Load the layer again (now it's not empty during loading)
  7. Try to edit vertices - now it works!
  8. Add more features - still the vertex tool works fine, also on new features
  9. Remove all features and GO TO 0. It doesn't work again
@troopa81

This comment has been minimized.

Copy link
Contributor

@troopa81 troopa81 commented Jan 10, 2020

I failed to reproduce the issue on both Linux and Windows with master (updated yesterday)

Here is what I am doing, to be sure I don't misunderstand the process

bugsnap

@gioman gioman added the Feedback label Jan 10, 2020
@borysiasty

This comment has been minimized.

Copy link
Member Author

@borysiasty borysiasty commented Jan 11, 2020

@troopa81 :
Do you have snapping enabled? I made hundreds additional tests ;) and realized it's dependent on the snapping state during layer loading and then entering the edit mode:

  1. If snapping is OFF all the time when loading the layer and entering the edit mode: everything works.

  2. If snapping is ON all the time when loading the layer and entering the edit mode: the bug occurs.

If I toggle snapping between loading the layer and entering the edit mode:

  1. Snapping is OFF during layer loading and then switched ON before entering the edit mode - the bug occurs.

  2. Snapping is ON during layer loading and then switched OFF before entering the edit mode - the results are mixed (random or rather dependant on something else).

All the four cases above refer to the first edit session after the layer is loaded. Then, if you rollback the edit mode and enter it again with snapping ON or OFF, the results seem to be persistent (I mean the same as in the first edit session) until the layer is removed from the project.

If you remove the layer and load it again, all symptoms seem to be reset, so you can start another test without any need of using multiple layers nor restarting QGIS in order to get replicable results.

@borysiasty

This comment has been minimized.

Copy link
Member Author

@borysiasty borysiasty commented Jan 11, 2020

In case 1) above, you can safely turn snapping on not earlier than after adding the first feature to the editing buffer.

@borysiasty borysiasty changed the title Vertex tool not working with PostGIS layers that were empty when opened. Snapping and vertex tool not working with PostGIS layers if the layer was empty and the snapping was enabled when loaded Jan 11, 2020
@gioman gioman removed the Feedback label Jan 12, 2020
@borysiasty borysiasty changed the title Snapping and vertex tool not working with PostGIS layers if the layer was empty and the snapping was enabled when loaded Snapping and vertex tool not working with some layers if snapping was enabled when loaded Jan 12, 2020
@troopa81

This comment has been minimized.

Copy link
Contributor

@troopa81 troopa81 commented Jan 13, 2020

If snapping is ON all the time when loading the layer and entering the edit mode: the bug occurs

That was it, I manage to reproduce now. Thanks for the details, I'll fix it.

troopa81 pushed a commit to troopa81/QGIS that referenced this issue Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.