mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Change the way associated PathStyles are created and updated.
This commit is contained in:
parent
05c0eb0e51
commit
c4203fe174
3 changed files with 5 additions and 8 deletions
|
@ -19,6 +19,7 @@ var Item = this.Item = Base.extend({
|
|||
|
||||
initialize: function() {
|
||||
paper.project.activeLayer.appendTop(this);
|
||||
this._style = PathStyle.create(this);
|
||||
this.setStyle(this._project.getCurrentStyle());
|
||||
},
|
||||
|
||||
|
@ -629,7 +630,7 @@ var Item = this.Item = Base.extend({
|
|||
},
|
||||
|
||||
setStyle: function(style) {
|
||||
this._style = PathStyle.create(this, style);
|
||||
this._style.initialize(style);
|
||||
},
|
||||
|
||||
// TODO: toString
|
||||
|
|
|
@ -44,13 +44,9 @@ var PathStyle = this.PathStyle = Base.extend(new function() {
|
|||
},
|
||||
|
||||
statics: {
|
||||
create: function(item, other) {
|
||||
create: function(item) {
|
||||
var style = new PathStyle(PathStyle.dont);
|
||||
// We need _item to be set before calling initialize(), since
|
||||
// it is setting bean properties that propagate changes through
|
||||
// all of item's children.
|
||||
style._item = item;
|
||||
style.initialize(other);
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ var Project = this.Project = Base.extend({
|
|||
this.activeView = canvas ? new ProjectView(canvas) : null;
|
||||
this._selectedItems = {};
|
||||
this._selectedItemCount = 0;
|
||||
this.setCurrentStyle(null);
|
||||
this._currentStyle = PathStyle.create(null);
|
||||
},
|
||||
|
||||
getCurrentStyle: function() {
|
||||
|
@ -41,7 +41,7 @@ var Project = this.Project = Base.extend({
|
|||
},
|
||||
|
||||
setCurrentStyle: function(style) {
|
||||
this._currentStyle = PathStyle.create(null, style);
|
||||
this._currentStyle.initialize(style);
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
|
|
Loading…
Reference in a new issue