mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Define Base.merge() and use it to merge _defaults in CharacterStyle.
This commit is contained in:
parent
0b0a43c4d5
commit
9b9810faf3
2 changed files with 8 additions and 3 deletions
|
@ -17,7 +17,6 @@
|
|||
// Extend Base with utility functions used across the library. Also set
|
||||
// this.Base, since bootstrap.js ommits that.
|
||||
this.Base = Base.inject({
|
||||
|
||||
/**
|
||||
* General purpose clone function that delegates cloning to the constructor
|
||||
* that receives the object to be cloned as the first argument.
|
||||
|
@ -100,6 +99,12 @@ this.Base = Base.inject({
|
|||
}
|
||||
},
|
||||
|
||||
merge: function(dest, src) {
|
||||
return Base.each(src, function(value, key) {
|
||||
this[key] = value;
|
||||
}, dest);
|
||||
},
|
||||
|
||||
/**
|
||||
* Capitalizes the passed string: hello world -> Hello World
|
||||
*/
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
var CharacterStyle = this.CharacterStyle = PathStyle.extend({
|
||||
/** @lends CharacterStyle# */
|
||||
|
||||
_defaults: {
|
||||
_defaults: Base.merge({
|
||||
fontSize: 10,
|
||||
font: 'sans-serif'
|
||||
},
|
||||
}, PathStyle.prototype._defaults),
|
||||
_owner: TextItem,
|
||||
_style: '_characterStyle'
|
||||
|
||||
|
|
Loading…
Reference in a new issue