@yscho wrote:
related issue with node width bestfit
When you run the code below
diagram.StartTransaction ();
node.resizeObject.width = NaN;
diagram.CommitTransaction ();As shown below, the width of the child node is
Some cases are miscalculated
and Some cases are well calculated.
Please advise for some reason.
Attach the source code below.
var defaultSubNodeTemplate = this.$go(go.Panel, "TableRow", { toolTip: this.$go(go.Adornment, "Auto", this.$go(go.Shape, { fill: "#FFFFCC" }), this.$go(go.TextBlock, { stroke: "black", textAlign: "left", margin: new go.Margin(2, 2, 2, 2) }, new go.Binding("text", "nfnm"))) }, new go.Binding("portId", "nid"), { name: "ITEMPANEL", background: "white", stretch: go.GraphObject.Horizontal, fromSpot: go.Spot.LeftRightSides, toSpot: go.Spot.LeftRightSides, fromLinkable: false, fromLinkableSelfNode: true, fromLinkableDuplicates: true, toLinkable: false, toLinkableSelfNode: true, toLinkableDuplicates: true, contextMenu: this.$go(go.Adornment) }, this.$go(go.Picture, { margin: 0, desiredSize: new go.Size(16, 16), background: "transparent", alignment: go.Spot.Left, column: 0 }, new go.Binding("source", "tpid", function(o) { return o + ".png"; })), this.$go(go.TextBlock, { name: "ITEMTEXT", alignment: go.Spot.Left, margin: new go.Margin(0, 16), stroke: "black", textAlign: "left", column: 0, stretch: go.GraphObject.Horizontal, wrap: go.TextBlock.None, overflow: go.TextBlock.OverflowEllipsis }, new go.Binding("text", "nnm"))); var headerPanel = this.$go(go.Panel, "Auto", { name: "HEADERPANEL", stretch: go.GraphObject.Horizontal }, { toolTip: this.$go(go.Adornment, "Auto", this.$go(go.Shape, { fill: "#FFFFCC" }), this.$go(go.TextBlock, { stroke: "black", textAlign: "left", margin: new go.Margin(2, 2, 2, 2) }, new go.Binding("text", "nfnm"))) }, this.$go(go.Shape, { name: "HEADER", fill: "#80838d", stroke: "transparent", portId: "", fromLinkable: false, fromLinkableSelfNode: true, fromLinkableDuplicates: true, toLinkable: false, toLinkableSelfNode: true, toLinkableDuplicates: true, fromSpot: go.Spot.LeftRightSides, toSpot: go.Spot.LeftRightSides }, new go.Binding("portId", "nid"), new go.Binding("fill", "#80838d")), this.$go(go.Picture, { margin: 0, desiredSize: new go.Size(16, 16), background: "transparent", alignment: go.Spot.Left }, new go.Binding("source", "tpid", function(o) { return o + ".png"; })), this.$go(go.TextBlock, { name: "HEADERTEXT", alignment: go.Spot.Left, margin: new go.Margin(0, 16), stroke: "ghostwhite", textAlign: "left", stretch: go.GraphObject.Horizontal, isMultiline: false, wrap: go.TextBlock.None, overflow: go.TextBlock.OverflowEllipsis }, new go.Binding("text", "nnm")), this.$go(go.Panel, "Auto", { name: "HEADERBG", alignment: go.Spot.Right, background: "#80838d", desiredSize: new go.Size(13, 13), margin: new go.Margin(0, 4), cursor: "pointer" }, new go.Binding("background", "#80838d"), this.$go(go.Shape, "TriangleUp", { name: "COLLAPSIBLEBUTTON", alignment: go.Spot.Center, fill: "white", stroke: "white", strokeWidth: 0, margin: new go.Margin(1, 3), desiredSize: new go.Size(10, 10) }) )); var defaultNodeTemplate = this.$go(go.Node, "Auto", { resizable: true, resizeObjectName: "NODE", resizeAdornmentTemplate: nodeResizeAdornmentTemplate, selectionAdornmentTemplate: nodeSelectionAdornmentTemplate, layoutConditions: go.Part.LayoutStandard & ~go.Part.LayoutNodeSized, layerName: "NodeLayer", selectionObjectName: "SHAPE", portSpreading: go.Node.SpreadingNone }, new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify), new go.Binding("layerName", "isSelected", function(sel) { return sel ? "Foreground" : "NodeLayer"; }).ofObject(), this.$go(go.Panel, "Vertical", this.$go(go.Panel, "Auto", { alignment: go.Spot.Left }, this.$go(go.Shape, "Rectangle", { name: "TITLE", fill: "transparent", stroke: "transparent" }), this.$go(go.TextBlock, { textAlign: "left", font: this.properties.bizTextFont }, new go.Binding("text", "bn"))), this.$go(go.Panel, "Auto", { alignment: go.Spot.Left }, this.$go(go.Shape, { name: "SHAPE", fill: "ghostwhite" }), this.$go(go.Panel, "Vertical", { name: "NODE", stretch: go.GraphObject.Fill, width: this.properties.nodeWidth, minSize: new go.Size(this.properties.nodeMinWidth, NaN) }, new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify), headerPanel, this.$go(go.Panel, "Table", { name: "LIST", defaultStretch: go.GraphObject.Horizontal, itemTemplate: defaultSubNodeTemplate, stretch: go.GraphObject.Fill, defaultRowSeparatorStroke: "#acac9a" }, new go.Binding("itemArray", "nodeList"))))));
Posts: 1
Participants: 1
