mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-06-07 02:34:17 -04: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
|
* @extends Item
|
||||||
*/
|
*/
|
||||||
var Group = this.Group = Item.extend(/** @lends Group# */{
|
var Group = this.Group = Item.extend(/** @lends Group# */{
|
||||||
|
_type: 'group',
|
||||||
|
|
||||||
// DOCS: document new Group(item, item...);
|
// DOCS: document new Group(item, item...);
|
||||||
/**
|
/**
|
||||||
* Creates a new Group item and places it at the top of the active layer.
|
* 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;
|
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
|
* The name of the item. If the item has a name, it can be accessed by name
|
||||||
* through its parent's children list.
|
* through its parent's children list.
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
* @extends Group
|
* @extends Group
|
||||||
*/
|
*/
|
||||||
var Layer = this.Layer = Group.extend(/** @lends Layer# */{
|
var Layer = this.Layer = Group.extend(/** @lends Layer# */{
|
||||||
|
_type: 'layer',
|
||||||
// DOCS: improve constructor code example.
|
// DOCS: improve constructor code example.
|
||||||
/**
|
/**
|
||||||
* Creates a new Layer item and places it at the end of the
|
* Creates a new Layer item and places it at the end of the
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
* @extends PlacedItem
|
* @extends PlacedItem
|
||||||
*/
|
*/
|
||||||
var PlacedSymbol = this.PlacedSymbol = PlacedItem.extend(/** @lends PlacedSymbol# */{
|
var PlacedSymbol = this.PlacedSymbol = PlacedItem.extend(/** @lends PlacedSymbol# */{
|
||||||
|
_type: 'placedsymbol',
|
||||||
/**
|
/**
|
||||||
* Creates a new PlacedSymbol Item.
|
* Creates a new PlacedSymbol Item.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* @extends PlacedItem
|
* @extends PlacedItem
|
||||||
*/
|
*/
|
||||||
var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
|
var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
|
||||||
|
_type: 'raster',
|
||||||
// Raster doesn't make the distinction between the different bounds,
|
// Raster doesn't make the distinction between the different bounds,
|
||||||
// so use the same name for all of them
|
// so use the same name for all of them
|
||||||
_boundsType: 'bounds',
|
_boundsType: 'bounds',
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* @extends PathItem
|
* @extends PathItem
|
||||||
*/
|
*/
|
||||||
var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
var CompoundPath = this.CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
|
_type: 'compoundpath',
|
||||||
/**
|
/**
|
||||||
* Creates a new compound path item and places it in the active layer.
|
* 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.
|
// DOCS: Explain that path matrix is always applied with each transformation.
|
||||||
var Path = this.Path = PathItem.extend(/** @lends Path# */{
|
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.
|
* Creates a new Path item and places it at the top of the active layer.
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
* @extends TextItem
|
* @extends TextItem
|
||||||
*/
|
*/
|
||||||
var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{
|
var PointText = this.PointText = TextItem.extend(/** @lends PointText# */{
|
||||||
|
_type: 'pointtext',
|
||||||
/**
|
/**
|
||||||
* Creates a point text item
|
* Creates a point text item
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue