* Network: force array order when sorting hierarchical levels
Fixes #340r34.
If coordinates are not available to sort within a hierarchical level, sort to array order instead.
The previous fix on this issue was not good enough to circumvent this quirk in the chromium sorting. This should bury it.
* Added TimSort for sorting in DirectionStrategy
* Added TimSort to LayoutEngine
* Fixed typo
* Add template for document generation with 'jsdoc'.
In essence, it defines the subdirectory `docs` as a `jsdoc` template. Benefits:
- allows the usage of partials, in order to DRY common parts of the html files.
- makes available the jsdoc-comments, for addition into the documentation.
- enables extraction of data from the source code. For example, the list of edge endpoints `['arrow', 'bar', 'circle']` can now be extracted from the source and inserted into the documentation on generation.
In this initial version, the only file that has been changed is `docs/data/dataset.html`.
In here, partials have been added to illustrate how common page elements can be DRY'd.
The template has been set up in such a way, that resource files will be copied and that html files can pass through unchanged if no special template tags (`<?js...?>`) are used. This allows for a gradual transition of the html files to templates.
**Usage:** `gulp docs`
- The result files are placed in subdirectory `gen/docs/`.
**NOTE:** The release procedure will have to be adjusted by adding this gulp command.
The docs-files will then have to be taken from `gen/docs`.
* Edits to docs/README
* Adjusted layout of README.md
* Further edits to README.md
* Removed pre tags again in README.md - don't work in code block
* Linted the gulpfile
* Added proof of concept for docs generation from source
* Move majorLables to 1st week in the month, for 'week' scale
* next() always adds 1 week to current date
* show 1st week in the month as majorLabel
* Add 'week' to auto-scale
* Update week scale example
* Revert "Move majorLables to 1st week in the month, for 'week' scale"
This reverts commit 52df3c3ac5.
* Correct value of week's minimumStep
* Network: DRY code in Label for parsing markup
This gets rid of a major eyesore for me. The accumulator object was identical for HTML and Markdown.
In addition, the parsing has been refactored. Common elements have been DRY'd and the logic of the parsing has been made more comprehensible.
* Added suggestion @mbroad wrt regexp precompile
* Fixed linting
* Adds code coverage report the output of `npm test` and adds detailed html code coverage report using the command `npm run-script test-cov`
* Switch over to using functions in lib/ rather than dist/, so that code coverage stats are complete.
* Import vis at the top level to keep ItemSet passing
* Remove requirement for dist/vis in TimelineItemSet
* Network: preload images in options for all shape types
Fixes#3532
If the images option is set, preload it, even if the node shape is not `image` or `circularImage`.
This needs to be done because the user can switch to an image shape later, as is happening in the issue.
Option `image` is only mandatory for the image shapes.
There is no unit test for this, because it would need a mock object for Image and I didn't succeed in creating/finding one.
* Network: Handle null data gracefully
During testing I discovered that passing `null` for network data leads to a thrown error.
This adds a guard to prevent it, plus unit tests for regression.
Fixes#3532
If the images option is set, preload it, even if the node shape is not `image` or `circularImage`.
This needs to be done because the user can switch to an image shape later, as is happening in the issue.
Option `image` is only mandatory for the image shapes.
There is no unit test for this, because it would need a mock object for Image and I didn't succeed in creating/finding one.
* Use mock canvas object replacing `canvas`
Fixes#3515.
A mock canvas object is added to the unit tests, which makes usage of module `canvas` voluntary.
The issue with `canvas` is that it requires an external dependency to `cairo`. This complicates setting up a develop environment for `vis.js`
- Removed `canvas` from `package.json`
- Added section to README.md with instructions on how to install `canvas` instead.
* Removed debugger statements
* Updates for review
* Fixes for review
* Network: Prevent crash when dataChanged is triggered during initial setting of options
Fixes#3562.
Options `hidden` and `physics` can emit a `_dataChanged` event within `setOptions()`.
If this happens when setting options during the initialization of the `Network` instance, this leads
to an error thrown, because there is no DataSet instance connected yet to the instance.
This bug was introduced in `v4.21.0`. Unit tests have been added for this case.
* Edited comment
Previous condition was too strict: if *any* node for the cluster was already clustered, the clustering would abort.
Current fix scans for already clustered nodes and proceeds with what is left.
* 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
Some browsers cannot handle very large DIVs so by default range DIVs
can be truncated outside the visible area. This change allows the use
of a new `limitSize` item option which disables this functionality,
allowing the creation of full-width DIVs.
I don’t see an existing test spec that covers RageItem.js so I’m
submitting without tests. However we’ve using Timeline in production on
a fairly large project with these changes in place for several months
and it works fine.
* Fixing a bug with the call to `repositionX`. The `items` collection is an object, not an array, so it cannot be iterated over using a normal for loop. Not repositioning the items causes the vertical stacking to jump around sporatically while scrolling.
* Update Group.js
* 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
* - Added support for vertical scrolling while the timeline is focusing on an element, both for animated and non-animated calls of focus
* - Adjusted item offset calculations to use the item parent
- Turned on animation for the focus in the example
- Updated function documentation
* - Fixing lint issues
* - Added documentation for the new 'frameCallback' parameter of 'setRange'
- Fixed the documentation on 'setRange' for the 'callback' parameter
- Fixed code not meeting style guidelines
* - Updated the example for "setSelection" to be more clear about what the example buttons do. Focus the language to be more consistent with that fact that the demo uses "setSelection"