first commit
This commit is contained in:
183
js/gojs/LinkLabelDraggingTool.js
Normal file
183
js/gojs/LinkLabelDraggingTool.js
Normal file
@@ -0,0 +1,183 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright (C) 1998-2022 by Northwoods Software Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
// A custom Tool for moving a label on a Link
|
||||
|
||||
/*
|
||||
* This is an extension and not part of the main GoJS library.
|
||||
* Note that the API for this class may change with any version, even point releases.
|
||||
* If you intend to use an extension in production, you should copy the code to your own source directory.
|
||||
* Extensions can be found in the GoJS kit under the extensions or extensionsJSM folders.
|
||||
* See the Extensions intro page (https://gojs.net/latest/intro/extensions.html) for more information.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends Tool
|
||||
* @class
|
||||
* This tool only works when the Link has a label
|
||||
* that is positioned at the Link.midPoint plus some offset.
|
||||
* It does not work for labels that have a particular segmentIndex.
|
||||
*/
|
||||
function LinkLabelDraggingTool() {
|
||||
go.Tool.call(this);
|
||||
this.name = "LinkLabelDragging";
|
||||
|
||||
/** @type {GraphObject} */
|
||||
this.label = null;
|
||||
/** @type {Point} */
|
||||
this._offset = new go.Point(); // of the mouse relative to the center of the label object
|
||||
/** @type {Point} */
|
||||
this._originalOffset = null;
|
||||
}
|
||||
go.Diagram.inherit(LinkLabelDraggingTool, go.Tool);
|
||||
|
||||
/**
|
||||
* This tool can only start if the mouse has moved enough so that it is not a click,
|
||||
* and if the mouse down point is on a GraphObject "label" in a Link Panel,
|
||||
* as determined by findLabel().
|
||||
* @this {LinkLabelDraggingTool}
|
||||
* @return {boolean}
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.canStart = function() {
|
||||
if (!go.Tool.prototype.canStart.call(this)) return false;
|
||||
var diagram = this.diagram;
|
||||
if (diagram === null) return false;
|
||||
// require left button & that it has moved far enough away from the mouse down point, so it isn't a click
|
||||
var e = diagram.lastInput;
|
||||
if (!e.left) return false;
|
||||
if (!this.isBeyondDragSize()) return false;
|
||||
|
||||
return this.findLabel() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* From the GraphObject at the mouse point, search up the visual tree until we get to
|
||||
* an object that is a label of a Link.
|
||||
* @this {LinkLabelDraggingTool}
|
||||
* @return {GraphObject} This returns null if no such label is at the mouse down point.
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.findLabel = function() {
|
||||
var diagram = this.diagram;
|
||||
var e = diagram.lastInput;
|
||||
var elt = diagram.findObjectAt(e.documentPoint, null, null);
|
||||
|
||||
if (elt === null || !(elt.part instanceof go.Link)) return null;
|
||||
while (elt.panel !== elt.part) {
|
||||
elt = elt.panel;
|
||||
}
|
||||
// If it's at an arrowhead segment index, don't consider it a label:
|
||||
if (elt.segmentIndex === 0 || elt.segmentIndex === -1) return null;
|
||||
return elt;
|
||||
};
|
||||
|
||||
/**
|
||||
* Start a transaction, call findLabel and remember it as the "label" property,
|
||||
* and remember the original value for the label's segmentOffset property.
|
||||
* @this {LinkLabelDraggingTool}
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.doActivate = function() {
|
||||
this.startTransaction("Shifted Label");
|
||||
this.label = this.findLabel();
|
||||
if (this.label !== null) {
|
||||
// compute the offset of the mouse-down point relative to the center of the label
|
||||
this._offset = this.diagram.firstInput.documentPoint.copy().subtract(this.label.getDocumentPoint(go.Spot.Center));
|
||||
this._originalOffset = this.label.segmentOffset.copy();
|
||||
}
|
||||
go.Tool.prototype.doActivate.call(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop any ongoing transaction.
|
||||
* @this {LinkLabelDraggingTool}
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.doDeactivate = function() {
|
||||
go.Tool.prototype.doDeactivate.call(this);
|
||||
this.stopTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear any reference to a label element.
|
||||
* @this {LinkLabelDraggingTool}
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.doStop = function() {
|
||||
this.label = null;
|
||||
go.Tool.prototype.doStop.call(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the label's original value for GraphObject.segmentOffset.
|
||||
* @this {LinkLabelDraggingTool}
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.doCancel = function() {
|
||||
if (this.label !== null) {
|
||||
this.label.segmentOffset = this._originalOffset;
|
||||
}
|
||||
go.Tool.prototype.doCancel.call(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* During the drag, call updateSegmentOffset in order to set
|
||||
* the GraphObject.segmentOffset of the label.
|
||||
* @this {LinkLabelDraggingTool}
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.doMouseMove = function() {
|
||||
if (!this.isActive) return;
|
||||
this.updateSegmentOffset();
|
||||
}
|
||||
|
||||
/**
|
||||
* At the end of the drag, update the segment offset of the label and finish the tool,
|
||||
* completing a transaction.
|
||||
* @this {LinkLabelDraggingTool}
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.doMouseUp = function() {
|
||||
if (!this.isActive) return;
|
||||
this.updateSegmentOffset();
|
||||
this.transactionResult = "Shifted Label";
|
||||
this.stopTool();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the label's GraphObject.segmentOffset as a rotated offset from the midpoint of the
|
||||
* Link that the label is in.
|
||||
* @this {LinkLabelDraggingTool}
|
||||
*/
|
||||
LinkLabelDraggingTool.prototype.updateSegmentOffset = function() {
|
||||
var lab = this.label;
|
||||
if (lab === null) return;
|
||||
var link = lab.part;
|
||||
if (!(link instanceof go.Link)) return;
|
||||
var last = this.diagram.lastInput.documentPoint;
|
||||
var idx = lab.segmentIndex;
|
||||
var numpts = link.pointsCount;
|
||||
if (isNaN(idx) && link.path) { // handle fractions along the whole path
|
||||
var labpt = link.path.getDocumentPoint(link.geometry.getPointAlongPath(lab.segmentFraction));
|
||||
var angle = link.geometry.getAngleAlongPath(lab.segmentFraction);
|
||||
var p = new go.Point(last.x - this._offset.x - labpt.x, last.y - this._offset.y - labpt.y);
|
||||
lab.segmentOffset = p.rotate(-angle);
|
||||
} else if (idx < -numpts || idx >= numpts) { // if the label is a "mid" label, assume it is positioned differently from a label at a particular segment
|
||||
var mid = link.midPoint;
|
||||
// need to rotate this point to account for the angle of the link segment at the mid-point
|
||||
var p = new go.Point(last.x - this._offset.x - mid.x, last.y - this._offset.y - mid.y);
|
||||
lab.segmentOffset = p.rotate(-link.midAngle);
|
||||
} else { // handle the label point being on a particular segment with a given fraction
|
||||
var frac = lab.segmentFraction;
|
||||
var a, b;
|
||||
if (idx >= 0) { // indexing forwards
|
||||
a = link.getPoint(idx);
|
||||
b = (idx < numpts - 1) ? link.getPoint(idx + 1) : a;
|
||||
} else { // or backwards if segmentIndex is negative
|
||||
var i = numpts + idx;
|
||||
a = link.getPoint(i);
|
||||
b = (i > 0) ? link.getPoint(i - 1) : a;
|
||||
}
|
||||
var labx = a.x + (b.x - a.x) * frac;
|
||||
var laby = a.y + (b.y - a.y) * frac;
|
||||
var p = new go.Point(last.x - this._offset.x - labx, last.y - this._offset.y - laby);
|
||||
var segangle = (idx >= 0) ? a.directionPoint(b) : b.directionPoint(a);
|
||||
lab.segmentOffset = p.rotate(-segangle);
|
||||
}
|
||||
}
|
||||
151
js/gojs/LinkLabelOnPathDraggingTool.js
Normal file
151
js/gojs/LinkLabelOnPathDraggingTool.js
Normal file
@@ -0,0 +1,151 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright (C) 1998-2022 by Northwoods Software Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
// A custom Tool for moving a label on a Link that keeps the label on the link's path.
|
||||
|
||||
/*
|
||||
* This is an extension and not part of the main GoJS library.
|
||||
* Note that the API for this class may change with any version, even point releases.
|
||||
* If you intend to use an extension in production, you should copy the code to your own source directory.
|
||||
* Extensions can be found in the GoJS kit under the extensions or extensionsJSM folders.
|
||||
* See the Extensions intro page (https://gojs.net/latest/intro/extensions.html) for more information.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends Tool
|
||||
* @class
|
||||
* This tool only works when the Link has a label marked by the "_isLinkLabel" property.
|
||||
*/
|
||||
function LinkLabelOnPathDraggingTool() {
|
||||
go.Tool.call(this);
|
||||
this.name = "LinkLabelOnPathDragging";
|
||||
|
||||
/** @type {GraphObject} */
|
||||
this.label = null;
|
||||
/** @type {number} */
|
||||
this._originalFraction = null;
|
||||
}
|
||||
go.Diagram.inherit(LinkLabelOnPathDraggingTool, go.Tool);
|
||||
|
||||
/**
|
||||
* This tool can only start if the mouse has moved enough so that it is not a click,
|
||||
* and if the mouse down point is on a GraphObject "label" in a Link Panel,
|
||||
* as determined by findLabel().
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
* @return {boolean}
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.canStart = function() {
|
||||
if (!go.Tool.prototype.canStart.call(this)) return false;
|
||||
var diagram = this.diagram;
|
||||
if (diagram === null) return false;
|
||||
// require left button & that it has moved far enough away from the mouse down point, so it isn't a click
|
||||
var e = diagram.lastInput;
|
||||
if (!e.left) return false;
|
||||
if (!this.isBeyondDragSize()) return false;
|
||||
|
||||
return this.findLabel() !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* From the GraphObject at the mouse point, search up the visual tree until we get to
|
||||
* an object that has the "_isLinkLabel" property set to true and that is an immediate child of a Link Panel.
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
* @return {GraphObject} This returns null if no such label is at the mouse down point.
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.findLabel = function() {
|
||||
var diagram = this.diagram;
|
||||
var e = diagram.lastInput;
|
||||
var elt = diagram.findObjectAt(e.documentPoint, null, null);
|
||||
|
||||
if (elt === null || !(elt.part instanceof go.Link)) return null;
|
||||
while (elt.panel !== elt.part) {
|
||||
elt = elt.panel;
|
||||
}
|
||||
// If it's not marked as "_isLinkLabel", don't consider it a label:
|
||||
if (!elt._isLinkLabel) return null;
|
||||
return elt;
|
||||
};
|
||||
|
||||
/**
|
||||
* Start a transaction, call findLabel and remember it as the "label" property,
|
||||
* and remember the original values for the label's segment properties.
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.doActivate = function() {
|
||||
this.startTransaction("Shifted Label");
|
||||
this.label = this.findLabel();
|
||||
if (this.label !== null) {
|
||||
this._originalFraction = this.label.segmentFraction;
|
||||
}
|
||||
go.Tool.prototype.doActivate.call(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop any ongoing transaction.
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.doDeactivate = function() {
|
||||
go.Tool.prototype.doDeactivate.call(this);
|
||||
this.stopTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear any reference to a label element.
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.doStop = function() {
|
||||
this.label = null;
|
||||
go.Tool.prototype.doStop.call(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the label's original value for GraphObject.segment... properties.
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.doCancel = function() {
|
||||
if (this.label !== null) {
|
||||
this.label.segmentFraction = this._originalFraction;
|
||||
}
|
||||
go.Tool.prototype.doCancel.call(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* During the drag, call updateSegmentOffset in order to set the segment... properties of the label.
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.doMouseMove = function() {
|
||||
if (!this.isActive) return;
|
||||
this.updateSegmentOffset();
|
||||
}
|
||||
|
||||
/**
|
||||
* At the end of the drag, update the segment properties of the label and finish the tool,
|
||||
* completing a transaction.
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.doMouseUp = function() {
|
||||
if (!this.isActive) return;
|
||||
this.updateSegmentOffset();
|
||||
this.transactionResult = "Shifted Label";
|
||||
this.stopTool();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the label's GraphObject.segmentFraction at the closest point to the mouse.
|
||||
* @this {LinkLabelOnPathDraggingTool}
|
||||
*/
|
||||
LinkLabelOnPathDraggingTool.prototype.updateSegmentOffset = function() {
|
||||
var lab = this.label;
|
||||
if (lab === null) return;
|
||||
var link = lab.part;
|
||||
if (!(link instanceof go.Link)) return;
|
||||
|
||||
var last = this.diagram.lastInput.documentPoint;
|
||||
// find the fractional distance along the link path closest to this point
|
||||
var path = link.path;
|
||||
var localpt = path.getLocalPoint(last);
|
||||
lab.segmentFraction = path.geometry.getFractionForPoint(localpt);
|
||||
}
|
||||
248
js/gojs/SerpentineLayout.js
Normal file
248
js/gojs/SerpentineLayout.js
Normal file
@@ -0,0 +1,248 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright (C) 1998-2022 by Northwoods Software Corporation. All Rights Reserved.
|
||||
*/
|
||||
|
||||
// A custom Layout that lays out a chain of nodes in a snake-like fashion
|
||||
|
||||
/*
|
||||
* This is an extension and not part of the main GoJS library.
|
||||
* Note that the API for this class may change with any version, even point releases.
|
||||
* If you intend to use an extension in production, you should copy the code to your own source directory.
|
||||
* Extensions can be found in the GoJS kit under the extensions or extensionsJSM folders.
|
||||
* See the Extensions intro page (https://gojs.net/latest/intro/extensions.html) for more information.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends Layout
|
||||
* @class
|
||||
* This layout assumes the graph is a chain of Nodes,
|
||||
* positioning nodes in horizontal rows back and forth, alternating between left-to-right
|
||||
* and right-to-left within the {@link #wrap} limit.
|
||||
* {@link #spacing} controls the distance between nodes.
|
||||
* {@link #leftSpot} and {@link #rightSpot} determine the Spots to use for the {@link Link#fromSpot} and {@link Link#toSpot}.
|
||||
* <p/>
|
||||
* When this layout is the Diagram.layout, it is automatically invalidated when the viewport changes size.
|
||||
*/
|
||||
function SerpentineLayout() {
|
||||
go.Layout.call(this);
|
||||
this.isViewportSized = true;
|
||||
this._spacing = new go.Size(30, 30);
|
||||
this._wrap = NaN;
|
||||
this._root = null;
|
||||
this._leftSpot = go.Spot.Left;
|
||||
this._rightSpot = go.Spot.Right;
|
||||
}
|
||||
go.Diagram.inherit(SerpentineLayout, go.Layout);
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
* Copies properties to a cloned Layout.
|
||||
* @this {SerpentineLayout}
|
||||
* @param {Layout} copy
|
||||
*/
|
||||
SerpentineLayout.prototype.cloneProtected = function(copy) {
|
||||
go.Layout.prototype.cloneProtected.call(this, copy);
|
||||
copy._spacing = this._spacing;
|
||||
copy._wrap = this._wrap;
|
||||
// don't copy _root
|
||||
copy._leftSpot = this._leftSpot;
|
||||
copy._rightSpot = this._rightSpot;
|
||||
};
|
||||
|
||||
/**
|
||||
* This method actually positions all of the Nodes, assuming that the ordering of the nodes
|
||||
* is given by a single link from one node to the next.
|
||||
* This respects the {@link #spacing} and {@link #wrap} properties to affect the layout.
|
||||
* @this {SerpentineLayout}
|
||||
* @param {Diagram|Group|Iterable} coll the collection of Parts to layout.
|
||||
*/
|
||||
SerpentineLayout.prototype.doLayout = function(coll) {
|
||||
var diagram = this.diagram;
|
||||
coll = this.collectParts(coll);
|
||||
|
||||
var root = this.root;
|
||||
if (root === null) {
|
||||
// find a root node -- one without any incoming links
|
||||
var it = coll.iterator;
|
||||
while (it.next()) {
|
||||
var n = it.value;
|
||||
if (!(n instanceof go.Node)) continue;
|
||||
if (root === null) root = n;
|
||||
if (n.findLinksInto().count === 0) {
|
||||
root = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// couldn't find a root node
|
||||
if (root === null) return;
|
||||
|
||||
var spacing = this.spacing;
|
||||
// calculate the width at which we should start a new row
|
||||
var wrap = this.wrap;
|
||||
if (diagram !== null && isNaN(wrap)) {
|
||||
if (this.group === null) { // for a top-level layout, use the Diagram.viewportBounds
|
||||
var pad = diagram.padding;
|
||||
wrap = Math.max(spacing.width * 2, diagram.viewportBounds.width - 24 - pad.left - pad.right);
|
||||
} else {
|
||||
wrap = 1000; // provide a better default value?
|
||||
}
|
||||
}
|
||||
|
||||
// implementations of doLayout that do not make use of a LayoutNetwork
|
||||
// need to perform their own transactions
|
||||
if (diagram !== null) diagram.startTransaction("Serpentine Layout");
|
||||
|
||||
// start on the left, at Layout.arrangementOrigin
|
||||
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
|
||||
var x = this.arrangementOrigin.x;
|
||||
var rowh = 0;
|
||||
var y = this.arrangementOrigin.y;
|
||||
var increasing = true;
|
||||
var node = root;
|
||||
while (node !== null) {
|
||||
var orignode = node;
|
||||
if (node.containingGroup !== null) node = node.containingGroup;
|
||||
var b = this.getLayoutBounds(node);
|
||||
// get the next node, if any
|
||||
var nextlink = null;
|
||||
for (var it = orignode.findLinksOutOf().iterator; it.next();) {
|
||||
if (coll.has(it.value)) { nextlink = it.value; break; }
|
||||
}
|
||||
var nextnode = (nextlink !== null ? nextlink.toNode : null);
|
||||
var orignextnode = nextnode;
|
||||
if (nextnode !== null && nextnode.containingGroup !== null) nextnode = nextnode.containingGroup;
|
||||
var nb = (nextnode !== null ? this.getLayoutBounds(nextnode) : new go.Rect());
|
||||
if (increasing) {
|
||||
node.move(new go.Point(x, y));
|
||||
x += b.width;
|
||||
rowh = Math.max(rowh, b.height);
|
||||
if (x + spacing.width + nb.width > wrap) {
|
||||
y += rowh + spacing.height;
|
||||
x = wrap - spacing.width;
|
||||
rowh = 0;
|
||||
increasing = false;
|
||||
if (nextlink !== null) {
|
||||
nextlink.fromSpot = this._rightSpot;
|
||||
nextlink.toSpot = this._rightSpot;
|
||||
}
|
||||
} else {
|
||||
x += spacing.width;
|
||||
if (nextlink !== null) {
|
||||
nextlink.fromSpot = this._rightSpot;
|
||||
nextlink.toSpot = this._leftSpot;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
x -= b.width;
|
||||
node.move(new go.Point(x, y));
|
||||
rowh = Math.max(rowh, b.height);
|
||||
if (x - spacing.width - nb.width < 0) {
|
||||
y += rowh + spacing.height;
|
||||
x = 0;
|
||||
rowh = 0;
|
||||
increasing = true;
|
||||
if (nextlink !== null) {
|
||||
nextlink.fromSpot = this._leftSpot;
|
||||
nextlink.toSpot = this._leftSpot;
|
||||
}
|
||||
} else {
|
||||
x -= spacing.width;
|
||||
if (nextlink !== null) {
|
||||
nextlink.fromSpot = this._leftSpot;
|
||||
nextlink.toSpot = this._rightSpot;
|
||||
}
|
||||
}
|
||||
}
|
||||
node = orignextnode;
|
||||
}
|
||||
|
||||
if (diagram !== null) diagram.commitTransaction("Serpentine Layout");
|
||||
};
|
||||
|
||||
// Public properties
|
||||
|
||||
/**
|
||||
* Gets or sets the {@link Size} whose width specifies the horizontal space between nodes
|
||||
* and whose height specifies the minimum vertical space between nodes.
|
||||
* The default value is 30x30.
|
||||
* @name SerpentineLayout#spacing
|
||||
* @return {Size}
|
||||
*/
|
||||
Object.defineProperty(SerpentineLayout.prototype, "spacing", {
|
||||
get: function() { return this._spacing; },
|
||||
set: function(val) {
|
||||
if (!(val instanceof go.Size)) throw new Error("new value for SerpentineLayout.spacing must be a Size, not: " + val);
|
||||
if (!this._spacing.equals(val)) {
|
||||
this._spacing = val;
|
||||
this.invalidateLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets or sets the total width of the layout.
|
||||
* The default value is NaN, which for {@link Diagram#layout}s means that it uses
|
||||
* the {@link Diagram#viewportBounds}.
|
||||
* @name SerpentineLayout#wrap
|
||||
* @return {number}
|
||||
*/
|
||||
Object.defineProperty(SerpentineLayout.prototype, "wrap", {
|
||||
get: function() { return this._wrap; },
|
||||
set: function(val) {
|
||||
if (this._wrap !== val) {
|
||||
this._wrap = val;
|
||||
this.invalidateLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets or sets the starting node of the sequence.
|
||||
* The default value is null, which causes the layout to look for a node without any incoming links.
|
||||
* @name SerpentineLayout#root
|
||||
* @return {Node}
|
||||
*/
|
||||
Object.defineProperty(SerpentineLayout.prototype, "root", {
|
||||
get: function() { return this._root; },
|
||||
set: function(val) {
|
||||
if (this._root !== val) {
|
||||
this._root = val;
|
||||
this.invalidateLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets or sets the Spot to use on the left side of a Node.
|
||||
* The default value is {@link Spot.Left}.
|
||||
* @name SerpentineLayout#leftSpot
|
||||
* @return {number}
|
||||
*/
|
||||
Object.defineProperty(SerpentineLayout.prototype, "leftSpot", {
|
||||
get: function() { return this._leftSpot; },
|
||||
set: function(val) {
|
||||
if (this._leftSpot !== val) {
|
||||
this._leftSpot = val;
|
||||
this.invalidateLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets or sets the Spot to use on the right side of a Node.
|
||||
* The default value is {@link Spot.Right}.
|
||||
* @name SerpentineLayout#rightSpot
|
||||
* @return {number}
|
||||
*/
|
||||
Object.defineProperty(SerpentineLayout.prototype, "rightSpot", {
|
||||
get: function() { return this._rightSpot; },
|
||||
set: function(val) {
|
||||
if (this._rightSpot !== val) {
|
||||
this._rightSpot = val;
|
||||
this.invalidateLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
2381
js/gojs/go-debug.js
Normal file
2381
js/gojs/go-debug.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user