mxHexagon.js 884 B

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