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

Ask for confirmation before auto-deleting an invalid polygon #56

Open
getkey opened this issue Jun 18, 2021 · 2 comments
Open

Ask for confirmation before auto-deleting an invalid polygon #56

getkey opened this issue Jun 18, 2021 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@getkey
Copy link
Owner

getkey commented Jun 18, 2021

The editor should warn you that if you unselect this polygon, it will be destroyed since it's invalid. But you will also be given the option to cancel to keep your invalid polygon selected so you can fix it.

Unselecting this polygon will remove it because it is invalid. Are you fine with that?
[Cancel] [OK]

More context: WMGX on Discord

@getkey getkey added enhancement New feature or request help wanted Extra attention is needed labels Jun 18, 2021
@voxxal
Copy link
Contributor

voxxal commented Jun 24, 2021

Maybe I can help, where is the file responsible for this?

@getkey
Copy link
Owner Author

getkey commented Jun 24, 2021

Gladly!

Here is the code that handles mouse events and updates the selection based on the selection box.

store.editor.setSelection(entitiesToAdd);

What I would do:

  1. for each element that's in the old selection but not in the new one
  2. if one of them is invalid (entity.params.isValid is false)
  3. show a popup (alert() is fine)
  4. if Ok -> continue normally
  5. if Cancel, use store.undoManager.stopGroup(); store.undoManager.undo(); to revert to the old selection box

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants