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.

44 lines
897 B

  1. 'use strict';
  2. import ShapeBase from '../util/ShapeBase'
  3. /**
  4. * A Diamond Node/Cluster shape.
  5. *
  6. * @extends ShapeBase
  7. */
  8. class Diamond extends ShapeBase {
  9. /**
  10. * @param {Object} options
  11. * @param {Object} body
  12. * @param {Label} labelModule
  13. */
  14. constructor(options, body, labelModule) {
  15. super(options, body, labelModule)
  16. }
  17. /**
  18. *
  19. * @param {CanvasRenderingContext2D} ctx
  20. * @param {number} x width
  21. * @param {number} y height
  22. * @param {boolean} selected
  23. * @param {boolean} hover
  24. * @param {ArrowOptions} values
  25. */
  26. draw(ctx, x, y, selected, hover, values) {
  27. this._drawShape(ctx, 'diamond', 4, x, y, selected, hover, values);
  28. }
  29. /**
  30. *
  31. * @param {CanvasRenderingContext2D} ctx
  32. * @param {number} angle
  33. * @returns {number}
  34. */
  35. distanceToBorder(ctx, angle) {
  36. return this._distanceToBorder(ctx,angle);
  37. }
  38. }
  39. export default Diamond;