mxTriangle.js 913 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Copyright (c) 2006-2015, JGraph Ltd
  3. * Copyright (c) 2006-2015, Gaudenz Alder
  4. */
  5. /**
  6. * Class: mxTriangle
  7. *
  8. * Implementation of the triangle shape.
  9. *
  10. * Constructor: mxTriangle
  11. *
  12. * Constructs a new triangle shape.
  13. */
  14. function mxTriangle()
  15. {
  16. mxActor.call(this);
  17. };
  18. /**
  19. * Extends mxActor.
  20. */
  21. mxUtils.extend(mxTriangle, mxActor);
  22. /**
  23. * Function: isRoundable
  24. *
  25. * Adds roundable support.
  26. */
  27. mxTriangle.prototype.isRoundable = function()
  28. {
  29. return true;
  30. };
  31. /**
  32. * Function: redrawPath
  33. *
  34. * Draws the path for this shape.
  35. */
  36. mxTriangle.prototype.redrawPath = function(c, x, y, w, h)
  37. {
  38. var arcSize = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, mxConstants.LINE_ARCSIZE) / 2;
  39. this.addPoints(c, [new mxPoint(0, 0), new mxPoint(w, 0.5 * h), new mxPoint(0, h)], this.isRounded, arcSize, true);
  40. };
  41. __mxOutput.mxTriangle = typeof mxTriangle !== 'undefined' ? mxTriangle : undefined;