mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Introduce Item#type, returning a simple item type string identifier.
This commit is contained in:
parent
a51f5af9c8
commit
19d145f281
8 changed files with 19 additions and 0 deletions
|
@ -24,6 +24,8 @@
|
|||
* @extends Item
|
||||
*/
|
||||
var Group = this.Group = Item.extend(/** @lends Group# */{
|
||||
_type: 'group',
|
||||
|
||||
// DOCS: document new Group(item, item...);
|
||||
/**
|
||||
* Creates a new Group item and places it at the top of the active layer.
|
||||
|
|
|
@ -176,6 +176,17 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{
|
|||
return this._id;
|
||||
},
|
||||
|
||||
/**
|
||||
* The type of the item as a string.
|
||||
*
|
||||
* @type String('group', 'layer', 'path', 'compoundpath', 'raster',
|
||||
* 'placedsymbol', 'pointtext')
|
||||
* @bean
|
||||
*/
|
||||
getType: function() {
|
||||
return this._type;
|
||||
},
|
||||
|
||||
/**
|
||||
* The name of the item. If the item has a name, it can be accessed by name
|
||||
* through its parent's children list.
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
* @extends Group
|
||||
*/
|
||||
var Layer = this.Layer = Group.extend(/** @lends Layer# */{
|
||||
_type: 'layer',
|
||||
// DOCS: improve constructor code example.
|
||||
/**
|
||||
* Creates a new Layer item and places it at the end of the
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
* @extends PlacedItem
|
||||
*/
|
||||
var PlacedSymbol = this.PlacedSymbol = PlacedItem.extend(/** @lends PlacedSymbol# */{
|
||||
_type: 'placedsymbol',
|
||||
/**
|
||||
* Creates a new PlacedSymbol Item.
|
||||
*
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* @extends PlacedItem
|
||||
*/
|
||||
var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
|
||||
_type: 'raster',
|
||||
// Raster doesn't make the distinction between the different bounds,
|
||||
// so use the same name for all of them
|
||||
_boundsType: 'bounds',
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* @extends PathItem
|
||||
*/
|
||||
var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||
_type: 'compoundpath',
|
||||
/**
|
||||
* Creates a new compound path item and places it in the active layer.
|
||||
*
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
// DOCS: Explain that path matrix is always applied with each transformation.
|
||||
var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
||||
_type: 'path',
|
||||
/**
|
||||
* Creates a new Path item and places it at the top of the active layer.
|
||||
*
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* @extends TextItem
|
||||
*/
|
||||
var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{
|
||||
_type: 'pointtext',
|
||||
/**
|
||||
* Creates a point text item
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue