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

selectionChanged event and skipUndoManager

$
0
0

@Jednorozec wrote:

Hello,

I know there has been this topic a few time before. But I still can’t find out, why is my skipUndoManager not working properly. I’ve implemented a changedSelection event on my Node to call this function:

function onSelectionChanged(node) {
      diagram.skipsUndoManager = true;
      diagram.startTransaction('tran');
      let textBlock = node.findObject('textBlock');
      let roundedRectangle = node.findObject('roundedRectangle');
      let rectangle = node.findObject('rectangle');
      let panelAddUser = node.findObject('panel-add-user');
      if (node.isSelected) {
        roundedRectangle.fill = node.data.color;
        roundedRectangle.strokeWidth = 4;
        textBlock.stroke = 'white';
        rectangle.alignment =  new go.Spot(0.5, 1.4);
        panelAddUser.alignment = new go.Spot(0.5, 1.8);
      } else {
        roundedRectangle.fill = colorSetOpacity25(node.data.color);
        roundedRectangle.strokeWidth = 0;
        textBlock.stroke = node.data.color;
        rectangle.alignment =  new go.Spot(0.5, 1.42);
        panelAddUser.alignment = new go.Spot(0.5, 2);
      }
      diagram.commitTransaction('tran');
      diagram.skipsUndoManager = false;
    }

But It seems that transaction is still performing. When I comment this piece of code, undoManager works just fine.

Thanks for any advice!

Posts: 8

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles