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.

46 lines
1.9 KiB

  1. 'use strict';
  2. import ShapeBase from '../util/ShapeBase'
  3. /**
  4. * A downward facing Triangle Node/Cluster shape.
  5. *
  6. * @class TriangleDown
  7. * @extends ShapeBase
  8. */
  9. class TriangleDown extends ShapeBase {
  10. /**
  11. * @param {Object} options
  12. * @param {Object} body
  13. * @param {Label} labelModule
  14. * @constructor TriangleDown
  15. */
  16. constructor(options, body, labelModule) {
  17. super(options, body, labelModule)
  18. }
  19. /**
  20. *
  21. * @param {CanvasRenderingContext2D} ctx
  22. * @param {Number} x
  23. * @param {Number} y
  24. * @param {Boolean} selected
  25. * @param {Boolean} hover
  26. * @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
  27. */
  28. draw(ctx, x, y, selected, hover, values) {
  29. this._drawShape(ctx, 'triangleDown', 3, x, y, selected, hover, values);
  30. }
  31. /**
  32. *
  33. * @param {CanvasRenderingContext2D} ctx
  34. * @param {Number} angle
  35. * @returns {Number}
  36. */
  37. distanceToBorder(ctx, angle) {
  38. return this._distanceToBorder(ctx,angle);
  39. }
  40. }
  41. export default TriangleDown;