mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Simplify Style creation.
This commit is contained in:
parent
41a58acb8c
commit
3025c63179
3 changed files with 3 additions and 11 deletions
|
@ -59,8 +59,8 @@ var Item = this.Item = Base.extend(Callback, {
|
||||||
// hierarchy. Used by Layer, where it's added to project.layers instead
|
// hierarchy. Used by Layer, where it's added to project.layers instead
|
||||||
if (!this._project)
|
if (!this._project)
|
||||||
paper.project.activeLayer.addChild(this);
|
paper.project.activeLayer.addChild(this);
|
||||||
this._style = Style.create(this);
|
this._style = new Style(this._project._currentStyle);
|
||||||
this.setStyle(this._project.getCurrentStyle());
|
this._style._item = this;
|
||||||
this._matrix = new Matrix();
|
this._matrix = new Matrix();
|
||||||
if (point)
|
if (point)
|
||||||
this._matrix.translate(point);
|
this._matrix.translate(point);
|
||||||
|
|
|
@ -50,10 +50,10 @@ var Project = this.Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
this.base(true);
|
this.base(true);
|
||||||
this.layers = [];
|
this.layers = [];
|
||||||
this.symbols = [];
|
this.symbols = [];
|
||||||
|
this._currentStyle = new Style();
|
||||||
this.activeLayer = new Layer();
|
this.activeLayer = new Layer();
|
||||||
if (view)
|
if (view)
|
||||||
this.view = view instanceof View ? view : View.create(view);
|
this.view = view instanceof View ? view : View.create(view);
|
||||||
this._currentStyle = new Style();
|
|
||||||
this._selectedItems = {};
|
this._selectedItems = {};
|
||||||
this._selectedItemCount = 0;
|
this._selectedItemCount = 0;
|
||||||
// See Item#draw() for an explanation of _drawCount
|
// See Item#draw() for an explanation of _drawCount
|
||||||
|
|
|
@ -216,14 +216,6 @@ var Style = this.Style = Base.extend(new function() {
|
||||||
+ this.getFont();
|
+ this.getFont();
|
||||||
},
|
},
|
||||||
|
|
||||||
statics: {
|
|
||||||
create: function(item) {
|
|
||||||
var style = Base.create(this);
|
|
||||||
style._item = item;
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// DOCS: why isn't the example code showing up?
|
// DOCS: why isn't the example code showing up?
|
||||||
/**
|
/**
|
||||||
* Style objects don't need to be created directly. Just pass an object to
|
* Style objects don't need to be created directly. Just pass an object to
|
||||||
|
|
Loading…
Reference in a new issue