* Network: Retain constraint values in label font handling
Fixes#3517.
Due to changed logic in the label font handling, the option values for `widthConstraint` and `heightConstraint` were overwritten.
The fix is in effect a reversal of two code lines: parsing constraint options should come *after* parsing (multi)font options.
Further changes:
- Additional 1-liner fix: constraint values were not copied for edge-instance specific options.
- Small refactoriing of `Label#constrain()` in order to separate concerns
- Added unit test for regression testing of this issue.
This leads to the curious observation that, while the actual change is two lines of source code, this resulted in a +-150 line regression test.
* Made unit test more linear, removed tabs
* Made 'enhanced subset' of unit test
* Removed TODO from comment
* Culled redundant nodes from unit test
* Network: Add extra check on null value during label handling
This fixes an oversight in #3486. Unit tests added, not only for null labels, but for all weird label values I could thing of.
* Enhanced unit tests, adjusted label check
* Small refactoring in Label._drawBackground()
* Added size calculation to Label, basic framework for detecting click on label.
* First fully working version of label click.
* Put in extra checks, refactored visibility of labels for more general usage.
* Final fixes to code; added to example and in docs
* Adressed review comments
* Add next attempt to fix Travis unit test bug
* Addressed review issues
Fixes#3483.
If `shape: 'image'` is defined as option, this was used for initializing hidden cluster nodes during layout initialization.
However, because no image is being passed, this led to an exception.
This fix prevens shape `image` from being used for hidden cluster nodes. In addition, some extra fields for these nodes are
now overridden for some performance improvament.
* The next fix on Travis unit test failure
This is the next escalation on the war against the Travis unit tests failing (which came into being by yours truly).
By accident, I could recreate the unit test failure on my development machine. This led to a more directed effort to
squash the bug.
The insight here is that test `(window === undefined)` fails, but `(typeof window === 'undefined`)` succeeds. This undoubtedly has to do with the special status `window` has as a global object.
Changes:
- Added check on presence of `window` in `Canvas._requestNextFrame()`, fixed local source errors.
- Added catch clause in `CanvasRendered._determinePixelRatio()`
- small fix: raised timeout for the network `worldCup2014` unit test
* Preliminary refactoring in utils.js
* Added unit tests for extend routines, commenting and small fixes
* More unit tests for extend routines
* - Completed unit tests for extend routines in
- Small fixes and cleanup in `util.js`
- Removed `util.protoExtend()`, not used anywhere
* Added unit tests for known font options
* Interim save before trying out another proto chain strategy
* Fixed problem in first example #3408
* Removed silly file that shouldn't be there
* Added unit test for multi-fonts
* Comment edits
* Verufy unit tests, small adjustments for groups
* Further work on getting unit tests to work. PARTS NEED TO BE CLEANED UP!
* Further tweaks to get unit tests working
* All unit tests passing
* Fixes due to linting
* Small edits
* Removed prototype handling from font pile
* Fixes during testing examples of #3408
* Added unit test for edge labels, small fixes
* Added unit tests for shorthand string fonts; some tests still failing
* All unit tests pass
* Removed Label.parseOptions()
* Completed shorthand font tests, code cleanup, fixed choosify for edges
* Addressed review comments
* Addressed review comments, cleanup
* Added unit test for Array.prototype mangling - first passing version
* Enhanced unit test for prototype stressing to catch more illegal for-in loops
* Fixed all for-in linting violations
* Add endpoint 'bar' to Network
Fixes#3412
- Adds class `Bar` and handling to `EndPoints.js`
- Adjusted `options.js` for endpoint, minor code changes
- Added to example `network/edgeTypes/arrowTypes`.
- Added to edges documentation
* Grumbl fix travis unit test yet again. Go die already!
* Network: Fixes sorting on Layout sorting, refactoring.
Fix for #3403
Chromium has divergent behaviour on sorting of `undefined` values, a check has been added for these.
The fix itself is small, it adds a check on `undefined` in the sorting function(s).
In addition:
- Fixed off-by-one error on tree index
- Refactored away checks on visibility by replacing `_isVisible()` with a Strategy pattern for direction
The latter removes a long-standing eyesore in `LayoutManager`; it's probably also faster.
There is some hope that these fixes will improve the hierarchical layout initialization, which has had
problems for quite a while.
* reformat code block
* Add next attempt to fix Travis unit test bug
* Fix unit test - timeout
* Adjustments for comment reviews
* Moved direction strategies to separate module; added fix for 'window is undefined'
This is the next escalation on the war against the Travis unit tests failing (which came into being by yours truly).
By accident, I could recreate the unit test failure on my development machine. This led to a more directed effort to
squash the bug.
The insight here is that test `(window === undefined)` fails, but `(typeof window === 'undefined`)` succeeds. This undoubtedly has to do with the special status `window` has as a global object.
Changes:
- Added check on presence of `window` in `Canvas._requestNextFrame()`, fixed local source errors.
- Added catch clause in `CanvasRendered._determinePixelRatio()`
- small fix: raised timeout for the network `worldCup2014` unit test
* Moved endpoint-specific code to module EndPoints
* Further decomposed functionality for endpoints
* Added commenting, notably for typedef's
* Add next attempt at fixing travis bug
* Added default sizes for nodes without labels
* Next attempt at fixing travis problem
* Fix on calculation of multifont labels - the height was calculated too large.
* added hexagon shape to the node.
* Updated function for hexagon shape.js
* Modifid the shape login for hexagon
* Remove this.translate from the Shape.js for hexagon
* updated hexagon draw logic
* Fixed code review comments and update the branch
* Updated changes in test.js
* Corrects usage of @static jsdoc annotation
* Correct unresolvable types
* Correct types in jsdoc and remove extraneous @class & @constructor jsdoc
* Remove incorrect @static jsdoc
* Adds missing jsdoc for param copyFromGlobals
* correct jsdoc in util
* Corrects casing on jsdocs
* Swaps @inheritDoc to @ignore for constructors where constructor args are documented in the class
* Instantiates Errors with `new`
* Addresses improperly defined @callback tags.
* Split callbacks out to separate jsdoc
* Moves constructor jsdocs back to constructor and drop @ignore.
* First fix for opening clusters, added unit tests
* Added opening of child cluster to parent cluster
* Added more tests for multi-level clusters
* Commenting fixes
* Added unit tests for option allowSingleNodeCluster, fixes due to that
* Added test for allowSingleNodeCluster with nested clusters
* Fixes due to linting
* Removed TODO from code
A recurring problem during travis tests is that global variable `window` can get reset while `Network` tests using a mock canvas object are running.
This issue has been adressed several times, but it still happens. This PR reduces the possibility of it happening again to a minimum.
PR's affected by this issue should be merged with this fix and re-submitted. At time of writing, these are:
- #3402
- #3405
- #3399
Chances are it will occur sporadically for other PR's as well.
Labelling this `High Priority` because it indrectly affects unrelated PR's.
Fix for #3367
Changes:
- Clustered nodes with shared connections are added to the same cluster
- joinCondition value `null` handled as `undefined`
- Fixed bug on adding clusters if joinCondition present and returns true
Unit tests have been added to `Network.test.js` for these changes.
* Added commenting for options, refactored choosify()
* Refactored updateLabelModule()
* added comment at node creation
* Completed fix for #3350
* parseOptions() different handling for bridged/extended; unit tests for reversal of options
* Fixes on linting and unit testing
* Enables require MethodDefinition for require-jsdoc lint rule and corrects 66% of missing Method Definitions
* Adds jsdoc for all remaining methods and corrects @class/@constructor documentation
* Define values more accurately
* Correct bugs that prevent jsdoc generation
* Enable unit testing for module Network
Adds mocks for certain components, in order to let module `Network` be run in unit tests.
Changes:
- Create a mock object for `hammer.js` when running browserless. The inspiration is taken from [here](https://github.com/uber/deck.gl/pull/658)
- Create a mock function for `window.requestAnimationFrame()` when running browserless in `network/modules/CanvasRenderer.js`
- Added unit test for `Network` to show that unit testing for it now works
- Fixed naming of container in `test/Graph3d.test.js`
Since `hammer.js` is also used in other modules, this fix is potentially an enabler for full-module unit tests for those as well.
* Cleanup unit test Network
* Fix for unit test
* Added example networks to unit test
* Fix error in loading disassemblerExample
* Network unit test final fixes
* Adjusted comments
* First working version of updating clustered edge
* Added fix for #1315 as well
* Enable unit testing for module Network
Adds mocks for certain components, in order to let module `Network` be run in unit tests.
Changes:
- Create a mock object for `hammer.js` when running browserless. The inspiration is taken from [here](https://github.com/uber/deck.gl/pull/658)
- Create a mock function for `window.requestAnimationFrame()` when running browserless in `network/modules/CanvasRenderer.js`
- Added unit test for `Network` to show that unit testing for it now works
- Fixed naming of container in `test/Graph3d.test.js`
Since `hammer.js` is also used in other modules, this fix is potentially an enabler for full-module unit tests for those as well.
* Cleanup unit test Network
* Added unit test for fix issue #1218
* Adding test for #1315 - Interim save
* Completed unit test and fixes for #1315
* Added fixes for #1291
* Added unit test for #1219
* Added header comment for Clustering.js, small fixes
* Fix for unit test
* Added example networks to unit test
* Fix error in loading disassemblerExample
* Network unit test final fixes
* Fixes for linting
* Fixed essential typo
* Fixed linting error
* Fixed unit test
* Fixed unit test again
* Makes network eslint compliant
Unused variables in private functions, who were never called internally with those arguments were removed.
lint rule was disabled for public functions, and in private functions which were called internally with those unused arguments
* Disables linting for unused args passed into DataSet and DataView
* Levels of direct hierarchical network only incremented
* Cleaned up old code
* Quick fix on presence globaOptions in mergeOptions()
* Revert fix, doesn't work
* Network: Block recalculation of level in LayoutEngine._determineLevelsDirected()
Fix for #2311.
Nodes with bidirectional edges got their levels shifted due to the handling of both edge directions.
This fix adds a check on bidirectionality and blocks any subsequent level adjustment.
Pure tree layouts are unaffected by this change.
* Code cleanup, for better understanding
* Further refactoring; text processing to blocks in separate method
* Added unit test for labels - tests standard text and html tags
* Labels added unit tests for markdown
* Further refactoring; made multi and regular handling more congruent
* Interim save, not there yet
* Unit tests done, first working version
* Added test case with two big words
* Code cleanup
* Break up huge words into lines.
* Restore unrelated code change
* Update hierarchy when node level changes
Fix for #3220
On change of data of an existing node, the level is checked for changes.
If changed, for a recalculation of the hierarchical layout.
The fix does not explicitly check for hierarchical layout; this should not be a problem.
The added code can be used to add further node fields which may trigger recalculation of layout.
* Changes due to review
* First interim commit
* Fixes during testing
* Allow multiple edges to be hidden by a clustered edge.
Fix for #3245.
This fix adjusts the clustering edges so that theyi can refer to multiple edges instead of just one.
This API method is now insufficient, since multiple base edges can be returned.
- Added replacing method `clustering.getBaseEdges()`
- Adjusted example `changingClusteredEdgeNodes` for the new method. This is the *only* place where `getBaseEdge()` was used
- Adjusted documentation for new method and deprecation old method.
Method `getbaseEdge()` should now be considered `deprecated`, and in due time should be removed.
* Edits of method name in example
* Edits of method name in example
* adjusted deprecation method getBaseEdge() in docs
* Adjusted deprecation method for getBaseEdge() in docs
Fix for #1222.
This makes the passed data of events `hoverNode`, `hoverEdge`, `blurNode` and `blurEdge`
more conformant to the passed data of the click events. In particular, the following
fields are added to the event data:
```
event: [Object] original hover event,
pointer: {
DOM: {x:pointer_x, y:pointer_y},
canvas: {x:canvas_x, y:canvas_y}
}
```
The changes can be tested with example `network/events/InteractionEvents`.
Fix for #3164
- `network.clustering.cluster()` now handles all nodes, not just the visible ones
- Changing ivisibility of nodes now explicitly takes clustering into account, see `Network._updateVisibleIndices()`
- `network.clustering` does not change `hidden` status any more.
The important part of this PR is the realization that 'hidden' and 'clustered' are two distinct things and should be handled separately.
In particular, clustering should **not** change the `hidden` state in any way.
* Add C++11 and canvas module for travis tests
* Added libgif, updated version gulp-clean-css
* Update version webpack
* Force versions minimatch, graceful-fs; fixes for upgraded webpack
* Force version minimatch through travis.yml
* Fix comma's in json
* Add extraneous modules to package.json; final attempt at forcing versions of minimatch and graceful-fs
* Final changes module versions
* Fix due to linting
* Fix typo in package.json
* Upgrade eslint
* Set dimensions properly of images on initialization.
Fix for #3203
Image nodes were assigned the default size on initialization, leading to very compressed images.
This fix adjusts the default size as soon as the images used have been loaded.
The approach for dealing with this has been adapted from `CircularImage`.
* Fixed tabs
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