Define Base.merge() and use it to merge _defaults in CharacterStyle.

This commit is contained in:
Jürg Lehni 2011-06-20 15:28:50 +01:00
parent 0b0a43c4d5
commit 9b9810faf3
2 changed files with 8 additions and 3 deletions

View file

@ -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
*/

View file

@ -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'