Skip to content

Commit

Permalink
Switch from new Base() to Base.set({}) where possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
lehni committed Feb 13, 2016
1 parent 009761d commit c3fff9f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/item/HitResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ var HitResult = Base.extend(/** @lends HitResult# */{
* @private
*/
getOptions: function(options) {
return new Base({
return Base.set({
// Type of item, for instanceof check: Group, Layer, Path,
// CompoundPath, Shape, Raster, SymbolItem, ...
type: null,
Expand Down
4 changes: 2 additions & 2 deletions src/item/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*/
extend: function extend(src) {
if (src._serializeFields)
src._serializeFields = new Base(
this.prototype._serializeFields, src._serializeFields);
src._serializeFields = Base.set({},
this.prototype._serializeFields, src._serializeFields);
return extend.base.apply(this, arguments);
},

Expand Down
2 changes: 1 addition & 1 deletion src/path/CompoundPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
// compound path forms one shape.
// Also support legacy format `type: 'path'`.
options.class === Path || options.type === 'path' ? options
: new Base(options, { fill: false }));
: Base.set({}, options, { fill: false }));
},

_draw: function(ctx, param, strokeMatrix) {
Expand Down
2 changes: 1 addition & 1 deletion src/style/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var Style = Base.extend(new function() {
selectedColor: null
},
// For TextItem, override default fillColor and add text-specific properties
textDefaults = new Base(defaults, {
textDefaults = Base.set({}, defaults, {
fillColor: new Color(), // black
// Characters
fontFamily: 'sans-serif',
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ var comparators = {
// Cloning SymbolItems does not result in cloned
// SymbolDefinitions
options && options.cloned
? new Base(options, { cloned: false })
? Base.set({}, options, { cloned: false })
: options,
['symbol']);
},
Expand Down

0 comments on commit c3fff9f

Please sign in to comment.