Sha256: bc4f15a6ad2c346a4460bbf64d0fbcf1be2a259fcafa5e9119771952effc44e2

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

/*
---
 
script: Shape.js
 
description: Base layer that provides shape
 
license: Public domain (http://unlicense.org).

authors: Yaroslaff Fedin
 
requires:
  - LSD.Layer
  - ART/ART.Shape
 
provides: 
  - LSD.Layer.Shape
 
...
*/

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) { var 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)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/lsd/Source/Layer/Shape.js
lsd_rails-0.1.5 Packages/lsd/Source/Layer/Shape.js
lsd_rails-0.1.4 Packages/lsd/Source/Layer/Shape.js
lsd_rails-0.1.3 Packages/lsd/Source/Layer/Shape.js
lsd_rails-0.1.2 Packages/lsd/Source/Layer/Shape.js
lsd_rails-0.1.1 Packages/lsd/Source/Layer/Shape.js
lsd_rails-0.1 Packages/lsd/Source/Layer/Shape.js