vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
624 B

  1. /**
  2. * Created by Alex on 3/19/2015.
  3. */
  4. class BaseNode {
  5. constructor(options, body, labelModule) {
  6. this.body = body;
  7. this.labelModule = labelModule;
  8. this.setOptions(options);
  9. this.top = undefined;
  10. this.left = undefined;
  11. this.height = undefined;
  12. this.boundingBox = {top: 0, left: 0, right: 0, bottom: 0};
  13. }
  14. setOptions(options) {
  15. this.options = options;
  16. }
  17. _distanceToBorder(angle) {
  18. var borderWidth = 1;
  19. return Math.min(
  20. Math.abs(this.width / 2 / Math.cos(angle)),
  21. Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth;
  22. }
  23. }
  24. export default BaseNode;