The returned node id's were exactly the wrong way around;
'to' returned the parents, 'from' returned the children.
This fix swaps the tests for determining which to return.
Code in the `_line()` of the sibling Bezier edge types was either extremely similar or identical.
The Bezier drawing code has been consolidated in a single method in the parent class.
This method is needlessly complicated. Code has been adjusted to better show the intent.
In addition:
- reuse of variables already present, notably `dx` and `dy`
- put recurring code fragments into local variables
- removed second conditions in constructs of the form `if (condition) ... else if (!conditioni) ...`
The refactoring can be taken further, but it would change the conditional flow, which would complicate reviewing.
The current changes highlight the similarities between the code blocks.
* Consolidate code for determining the pixel ratio
* - Removed local param 'pixerRatio' from CanvasRenderer. Now only canvas.pixelRatio is used.
- consolidated ctx.transform() calls in Canvas
- Added/edited commenting (also TODO's)
- Added Canvas.getContext()
Fix for #3036
Option `smooth.type: dynamic` is not allowed for hierarchical layouts.
This was handled properly for the main options, but not for the node-specific options.
Options within node instances arei now checked for `smooth.type: dynamic` and replaced
by `horizontal` or `vertical`. The implementation adds listener `_adjustEdgesForHierarchicalLayout`
in `LayoutHandler`. This listener must be activated every time noder- specific options might change.
This happens in the logical places within `EdgeHandler`.
* Protect Network from zero and negative mass values
Fix for #3133
Option-field 'node.mass` must be >= 0.
Checks have been added at the nodes level, for both nodes-global and nodes specific options.
In addition, an internal check has been added for `NodeHandler.defaultOptions`.
The documentation has been adjusted for this change.
* Fix whitespace
* Prevent crashes from invalid id's in `Clustering.findNode()`
Fix for #3163
- Added safeguards in said method, to prevent exceptions happening when invalid id's are passed in.
- Adjusted documentation for said method
- Added notes to flag unused methods in `Clustering.js`
* Removed incorrect NOTE-comments from methods that are indeed used
Call on issue brought to light by #2990.
`ctx` should not be passed as a parameter to the call - not needed and not conform to documentation.
Also cleaned up the calling code to remove the double `fontOptions.chooser()` call.
* replacing all ES6 imports with CJS require calls
resolves#2934
used the following regex to apply the changes in lib:
s/import\s+(\w+)\s+from\s+(.*);\s*$/var $1 = require($2).default;/
s/import\s+(\w+)\s+from\s+(.*)\s*$/var $1 = require($2).default;/
* cleaning up inconsistencies
* CachedImage with preredendered zoom images; first working version.
* Fixes for missing images and usage brokenImage.
* Remove unused method
* Added height member of CachedImage, note about svg's
* Network: use separate refresh indicator in NodeBase, instead of width parameter
* Added usage of iBaseNode.doRefresh to image shapes.
* Rearranged code in NodeBase.needRefresh()
* Fixes for review
* Removed strange link
* Added 's' in needsRefresh(); typo fix
* Fixes for review, code cleanup
* Modified ratio calc to original working.
* Made code in CircularImage.resize() more sensible.
* Reduce the time-complexity of the network initial positioning. Very substantial performance gain for large graphs.
* Remove unwanted console messages, extended comment.
* Improve the performance of the network layout engine
Short-cut the execution of a number of methods in LayoutEngine to make them
handle highly-connected graphs better.
* Demonstrations of layouts of large networks
* maximum width constraints must be violated by long words. Fixes#2604.
* chore: moved examples/network/_tests/maximumWidthEdgeCase.html to test/network/
Using the 'directed' sort method, the layout engine seemed to ignore treeSpacing (or only apply it to the first tree). This would also lead to trees colliding with one another, and having their nodes tangled in space. This complaint surfaced in a couple bugs, including #2494. This should be a step toward fixing that. For whatever reason, this code never runs when using the "hubsize" sort method.
* self reference edge should now appear in all cases
* add checks for shape width being NaN to get correct circle data
* reorder resize arguments in Diamond, Dot and Star
* fix#2613 with if statement, and null for pointer value rather than referencing it when undefined
* removed if statement, since not needed, and updated documentation to note the null pointer property in certain conditions.
* Added HTML tooltip support for Timeline
* Fixed tooltip position on Firefox
* Added Timeline tooltip example
* Updated tooltip location to be next to the mouse
* Added HTML element to example