mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Fix wrong default fillColor on TextItems.
This commit is contained in:
parent
cb0dcf1719
commit
34ad9045cc
2 changed files with 16 additions and 11 deletions
|
@ -72,8 +72,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
else
|
else
|
||||||
this._setProject(project);
|
this._setProject(project);
|
||||||
}
|
}
|
||||||
this._style = new Style(this._project._currentStyle);
|
this._style = new Style(this._project._currentStyle, this);
|
||||||
this._style._item = this;
|
|
||||||
this._matrix = new Matrix();
|
this._matrix = new Matrix();
|
||||||
if (point)
|
if (point)
|
||||||
this._matrix.translate(point);
|
this._matrix.translate(point);
|
||||||
|
@ -382,7 +381,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
},
|
},
|
||||||
|
|
||||||
setStyle: function(style) {
|
setStyle: function(style) {
|
||||||
this._style.initialize(style);
|
this._style.set(style);
|
||||||
},
|
},
|
||||||
|
|
||||||
hasFill: function() {
|
hasFill: function() {
|
||||||
|
|
|
@ -202,17 +202,23 @@ var Style = Base.extend(new function() {
|
||||||
Item.inject(item);
|
Item.inject(item);
|
||||||
return fields;
|
return fields;
|
||||||
}, /** @lends Style# */{
|
}, /** @lends Style# */{
|
||||||
initialize: function Style(style) {
|
initialize: function Style(style, _item) {
|
||||||
// We keep values in a separate object that we can iterate over.
|
// We keep values in a separate object that we can iterate over.
|
||||||
this._values = {};
|
this._values = {};
|
||||||
if (this._item instanceof TextItem)
|
this._item = _item;
|
||||||
|
if (_item instanceof TextItem)
|
||||||
this._defaults = this._textDefaults;
|
this._defaults = this._textDefaults;
|
||||||
if (style) {
|
if (style)
|
||||||
// If the passed style object is also a Style, clone its clonable
|
this.set(style);
|
||||||
// fields rather than simply copying them.
|
},
|
||||||
var isStyle = style instanceof Style,
|
|
||||||
// Use the other stlyle's _values object for iteration
|
set: function(style) {
|
||||||
values = isStyle ? style._values : style;
|
// If the passed style object is also a Style, clone its clonable
|
||||||
|
// fields rather than simply copying them.
|
||||||
|
var isStyle = style instanceof Style,
|
||||||
|
// Use the other stlyle's _values object for iteration
|
||||||
|
values = isStyle ? style._values : style;
|
||||||
|
if (values) {
|
||||||
for (var key in values) {
|
for (var key in values) {
|
||||||
if (key in this._defaults) {
|
if (key in this._defaults) {
|
||||||
var value = values[key];
|
var value = values[key];
|
||||||
|
|
Loading…
Reference in a new issue