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

Binding to location with animation and undo cause change not in trasuction

$
0
0

@uriel wrote:

I have the code below

when i run the code (with gojs debug)

I can see this on the console
Change not within a transaction: !d initialContentAlignment: Diagram “godiagram” old: Default new: Spot(0.5,0.5)
go-debug.js:35 Change not within a transaction: !d nodeTemplate: Diagram “godiagram” old: Node#274 new: Node#413
demo.component.js:55 print
go-debug.js:35 Change not within a transaction: !d position: Alpha old: Point(1.5211111111111113,1.5211111111111113) new: Point(50,50)
go-debug.js:35 Change not within a transaction: !d location: Alpha old: Point(1.5211111111111113,1.5211111111111113) new: Point(50,50)

trying to Isolate the problem I found that If I disable the animation and undo manager than I will not get the transaction problem.

any idea how to solve this?

This is the code

  diagram.undoManager.isEnabled = true;
    diagram.animationManager.isEnabled = true;
    diagram.initialContentAlignment = go.Spot.Center;

    let $ = GraphObject.make;
    diagram.nodeTemplate =
        $(go.Node, "Auto",
            new go.Binding("location", "", (a: any, b) => {
                return new Point(a.holder.loc.x, a.holder.loc.y);
            }).makeTwoWay((a: any, b: any, model: Model) => {
                b.holder.loc = new Point(a.x, a.y);
            }),
            $(go.Shape, "RoundedRectangle",
                {fill: "white"},
                new go.Binding("fill", "color")),  // shape.fill = data.color
            $(go.TextBlock,
                {margin: 5},
                new go.Binding("text", "key"))  // textblock.text = data.key
        );


    var nodeDataArray = [
        {key: "Alpha", color: "lightblue", holder: {loc: new go.Point(50, 50)}},
    ];
    var linkDataArray = [
        {from: "Alpha", to: "Beta", color: "blue", thick: 2}
    ];
    linkDataArray = [];
    diagram.model = new go.GraphLinksModel(nodeDataArray, linkDataArray);
    setTimeout(() => {
        diagram.updateAllTargetBindings();
    }, 1000);
}

Posts: 8

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles