sigma.canvas.nodes.def.js 769 B

123456789101112131415161718192021222324252627282930
  1. ;(function() {
  2. 'use strict';
  3. sigma.utils.pkg('sigma.canvas.nodes');
  4. /**
  5. * The default node renderer. It renders the node as a simple disc.
  6. *
  7. * @param {object} node The node object.
  8. * @param {CanvasRenderingContext2D} context The canvas context.
  9. * @param {configurable} settings The settings function.
  10. */
  11. sigma.canvas.nodes.def = function(node, context, settings) {
  12. var prefix = settings('prefix') || '';
  13. context.fillStyle = node.color || settings('defaultNodeColor');
  14. context.beginPath();
  15. context.arc(
  16. node[prefix + 'x'],
  17. node[prefix + 'y'],
  18. node[prefix + 'size'],
  19. 0,
  20. Math.PI * 2,
  21. true
  22. );
  23. context.closePath();
  24. context.fill();
  25. };
  26. })();