mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-01 00:29:29 -04: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
src
|
@ -17,7 +17,6 @@
|
||||||
// Extend Base with utility functions used across the library. Also set
|
// Extend Base with utility functions used across the library. Also set
|
||||||
// this.Base, since bootstrap.js ommits that.
|
// this.Base, since bootstrap.js ommits that.
|
||||||
this.Base = Base.inject({
|
this.Base = Base.inject({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General purpose clone function that delegates cloning to the constructor
|
* General purpose clone function that delegates cloning to the constructor
|
||||||
* that receives the object to be cloned as the first argument.
|
* 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
|
* Capitalizes the passed string: hello world -> Hello World
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
var CharacterStyle = this.CharacterStyle = PathStyle.extend({
|
var CharacterStyle = this.CharacterStyle = PathStyle.extend({
|
||||||
/** @lends CharacterStyle# */
|
/** @lends CharacterStyle# */
|
||||||
|
|
||||||
_defaults: {
|
_defaults: Base.merge({
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
font: 'sans-serif'
|
font: 'sans-serif'
|
||||||
},
|
}, PathStyle.prototype._defaults),
|
||||||
_owner: TextItem,
|
_owner: TextItem,
|
||||||
_style: '_characterStyle'
|
_style: '_characterStyle'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue