not really known
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.

42 lines
1.2 KiB

  1. /**
  2. _enyo.canvas.Shape_ is the base kind for shapes that can be drawn into the
  3. canvas. It doesn't have a default rendering, but an event handler may call
  4. the _draw_ method on it.
  5. Kinds derived from this one should provide their own implementation of
  6. _renderSelf_. If more complex operations are needed for filled mode or
  7. outline mode, override the _fill_ or _outline_ methods, respectively.
  8. */
  9. enyo.kind({
  10. name: "enyo.canvas.Shape",
  11. kind: enyo.canvas.Control,
  12. published: {
  13. //* Color used to draw the interior of the shape
  14. color: "red",
  15. //* Color used to draw the outline of the shape
  16. outlineColor: ""
  17. },
  18. //* @protected
  19. fill: function(inContext) {
  20. inContext.fill();
  21. },
  22. outline: function(inContext) {
  23. inContext.stroke();
  24. },
  25. //* @public
  26. /**
  27. Draws the shape by invoking the shape's fill or outline methods,
  28. usually invoked by the derived shape's renderSelf method in response
  29. to the parent of the CanvasControls rendering.
  30. */
  31. draw: function(inContext) {
  32. if (this.color) {
  33. inContext.fillStyle = this.color;
  34. this.fill(inContext);
  35. }
  36. if (this.outlineColor) {
  37. inContext.strokeStyle = this.outlineColor;
  38. this.outline(inContext);
  39. }
  40. }
  41. });