From c3fff9fa831b14f2015c27ab117cb8eb2615d6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 13 Feb 2016 23:10:09 +0100 Subject: [PATCH] Switch from new Base() to Base.set({}) where possible. --- src/item/HitResult.js | 2 +- src/item/Item.js | 4 ++-- src/path/CompoundPath.js | 2 +- src/style/Style.js | 2 +- test/helpers.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/item/HitResult.js b/src/item/HitResult.js index 69d4bd55..f59f6975 100644 --- a/src/item/HitResult.js +++ b/src/item/HitResult.js @@ -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, diff --git a/src/item/Item.js b/src/item/Item.js index 340f9ac6..b4ee5dd9 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -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); }, diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 18278e27..d52d0754 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -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) { diff --git a/src/style/Style.js b/src/style/Style.js index 529ec40c..e0a19113 100644 --- a/src/style/Style.js +++ b/src/style/Style.js @@ -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', diff --git a/test/helpers.js b/test/helpers.js index d786eb55..9322bff6 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -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']); },