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
1.8 KiB

  1. 'use strict';
  2. import ShapeBase from '../util/ShapeBase'
  3. /**
  4. * A downward facing Triangle Node/Cluster shape.
  5. *
  6. * @extends ShapeBase
  7. */
  8. class TriangleDown 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
  21. * @param {number} y
  22. * @param {boolean} selected
  23. * @param {boolean} hover
  24. * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values
  25. */
  26. draw(ctx, x, y, selected, hover, values) {
  27. this._drawShape(ctx, 'triangleDown', 3, 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 TriangleDown;