Skip to content

Commit

Permalink
refactor(configurator): final refactoring before extraction (#1262)
Browse files Browse the repository at this point in the history
* refactor(configurator): final refactoring before extraction

- Exctract hardcoded physics solver and wind code from the configurator into reusable hideOptions function passed in the constructor.
- Add TS types explicitly declaring the structure of the input (in other words: formally declare the API of the configurator).

* chore: update copyright
  • Loading branch information
Thomaash authored Jan 3, 2021
1 parent 1446293 commit 9b516ad
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 203 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
## License

Copyright (C) 2010-2018 Almende B.V. and Contributors
Copyright (c) 2018-2021 Vis.js contributors

Vis.js is dual licensed under both

Expand Down
6 changes: 6 additions & 0 deletions __snapshots__/test/package.test.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ exports['Package Exported files 1'] = {
" declarations/network/modules/view-handler/index.d.ts",
" declarations/network/modules/view-handler/index.d.ts.map",
" declarations/network/options.d.ts",
" declarations/network/options.d.ts.map",
" declarations/network/shapes.d.ts",
" declarations/network/shapes.d.ts.map",
" declarations/shared/configurator-types.d.ts",
" declarations/shared/configurator-types.d.ts.map",
" declarations/shared/index.d.ts",
" declarations/shared/index.d.ts.map",
" dist/dist/vis-network.css",
Expand Down Expand Up @@ -136,8 +139,11 @@ exports['Package Exported files 1'] = {
" dist/types/network/modules/view-handler/index.d.ts",
" dist/types/network/modules/view-handler/index.d.ts.map",
" dist/types/network/options.d.ts",
" dist/types/network/options.d.ts.map",
" dist/types/network/shapes.d.ts",
" dist/types/network/shapes.d.ts.map",
" dist/types/shared/configurator-types.d.ts",
" dist/types/shared/configurator-types.d.ts.map",
" dist/types/shared/index.d.ts",
" dist/types/shared/index.d.ts.map",
" dist/vis-network.esm.js",
Expand Down
9 changes: 7 additions & 2 deletions lib/network/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import LayoutEngine from "./modules/LayoutEngine";
import ManipulationSystem from "./modules/ManipulationSystem";
import { Configurator } from "../shared";
import { VALIDATOR_PRINT_STYLE, Validator } from "../shared";
import { allOptions, configureOptions } from "./options.js";
import {
allOptions,
configureOptions,
configuratorHideOption,
} from "./options";
import KamadaKawai from "./modules/KamadaKawai.js";

/**
Expand Down Expand Up @@ -230,7 +234,8 @@ Network.prototype.setOptions = function (options) {
this,
this.body.container,
configureOptions,
this.canvas.pixelRatio
this.canvas.pixelRatio,
configuratorHideOption
);
}

Expand Down
Loading

0 comments on commit 9b516ad

Please sign in to comment.