Requires

Provides

Shape.js

Base layer that provides shape

License:
Public domain (http://unlicense.org).
Authors:
Yaroslaff Fedin
  1. 23
  2. 24
  3. 25
  4. 26
  5. 27
  6. 28
  7. 29
  8. 30
  9. 31
  10. 32
  11. 33
  12. 34
  13. 35
  14. 36
  15. 37
  16. 38
  17. 39
  18. 40
  19. 41
  20. 42
  21. 43
  22. 44
  23. 45
  24. 46
  25. 47
  26. 48
  27. 49
  28. 50
  29. 51
  30. 52
  31. 53
  32. 54
  33. 55
  34. 56
  35. 57
LSD.Layer.Styles = {} LSD.Layer.Shape = { properties: { shape: ['url', 'shape', 'glyph'] }, paint: function(shape) { return { shape: shape } }, onCompile: function(name) { for (var shape in ART.Shape) { var klass = ART.Shape[shape]; if (!klass || !klass.prototype || !klass.prototype.properties) continue; var properties = klass.prototype.properties; LSD.Layer.Styles[name + shape] = properties.map(function(prop) { return name + prop.capitalize()}); } } } Object.append(SheetParser.Property.Type, { shape: function(value) { if (value.indexOf) var name = value else for (var key in value) { name = key; break}; return !!ART.Shape[name.capitalize()] }, glyph: function(value) { return value.glyph } }); LSD.Styles.shape = SheetParser.Property.compile(LSD.Layer.Shape.properties.shape)