Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

How to safely ignore some changes while using the UndoManager?

$
0
0

@Jany wrote:

Hello,

I'm using GoJS version 1.7.5. My diagram has two kinds of user interactions:

  1. ephemeral, non-important changes: on mouve-over, some links are highlighted, also sometimes nodes are decorated/highlighted... various stuff
  2. important changes: on click, some nodes/groups are expanded, nodes and links are added and removed, all in a transaction.

My goal is to allow users to undo/redo the important changes, without bothering about ephemeral changes. Until now I have tried two strategies unsuccessfully:

  1. Wrap all ephemeral changes in skipsUndoManager = true; ...; skipsUndoManager = false, but that led to the same kinds of problems that are mentioned in https://forum.nwoods.com/t/how-can-i-skip-the-default-transaction-in-undomanager/6487/4

    In my case, after an undo, links where left floating in the void, not connected to any nodes. Also, sometimes, during an undo, I had warnings about link points being changed out a transaction.

  2. Just today, I saw the previous issue where Walter recommends to not use skipsUndoManager so I tried another strategy:

    • always have a top-level transaction open, to record all the ephemeral changes
    • just before an important change, rollback that transaction
    • go on with the important change
    • then open again the ephemeral-event-transaction.

    That didn't work, because it seems to me that GoJS kills my "ephemeral transaction" pretty quickly, so that ephemeral changes trigger warnings about "not in a transaction". Then I saw that other issue which says that transactions should be short: https://forum.nwoods.com/t/how-to-set-start-transaction-commit-time-in-gojs/8026 and I gave up.

What should I do? Is there a way to get one of my two strategies to work, or is there a third way to accomplish that? Thanks in advance.

Jany Belluz

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles