Skip to content

[Feature Request] Undo/redo: ablitity to skip adding to history and isolated undo/redo scopes/collections #852

@RLaipins

Description

@RLaipins

Before I start I wanted to thank you for this functionality!

Is your feature request related to a problem? Please describe.
I'm running into two issues with the session undo/redo history. Maybe they are just specific to my use-case and I should try to find workarounds programmatically.

  1. I can't bypass adding features to history. Currently I persist my previous drawings from localStore and load them in on page refresh with addFeatures(). Problem is that addFeatures() pushes them to the terra-draw session history. With this I can accidentally remove previously drawn features, which can be unexpected.

  2. Can't isolate history between editing contexts. I have two workflows using terra-draw: regular drawing/editing, and a separate object editing mode where I programmatically load existing GeoJSON as temporary terra-draw features with addFeatures() and clean them up with removeFeatures() when editing ends. Currently if I enable session undo/redo, the second workflow messes up the history of the first and there's no way to keep them separate.

Describe your proposed idea for the solution to this problem

  1. It would be nice to have a skipHistory option on addFeatures and removeFeatures so programmatically I could skip adding them to the history. Or maybe a way to clear history.

  2. Named history collections and a way to switch between them. User could programmatically create additional history stores/collections and switch between them.

Describe alternatives you've considered
Manually tracking undo/redo size to allow/disallow pressing undo/redo buttons for my different workflows, but It would be flawed as I couldn't skip certain indexes or tell which history event to undo. I also contemplated creating my own undo/redo history tracker, but as there is already something inbuilt it would a shame not to use it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions