Switch from new Base() to Base.set({}) where possible.

This commit is contained in:
Jürg Lehni 2016-02-13 23:10:09 +01:00
parent 009761d13c
commit c3fff9fa83
5 changed files with 6 additions and 6 deletions

View file

@ -107,7 +107,7 @@ var HitResult = Base.extend(/** @lends HitResult# */{
* @private * @private
*/ */
getOptions: function(options) { getOptions: function(options) {
return new Base({ return Base.set({
// Type of item, for instanceof check: Group, Layer, Path, // Type of item, for instanceof check: Group, Layer, Path,
// CompoundPath, Shape, Raster, SymbolItem, ... // CompoundPath, Shape, Raster, SymbolItem, ...
type: null, type: null,

View file

@ -30,8 +30,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*/ */
extend: function extend(src) { extend: function extend(src) {
if (src._serializeFields) if (src._serializeFields)
src._serializeFields = new Base( src._serializeFields = Base.set({},
this.prototype._serializeFields, src._serializeFields); this.prototype._serializeFields, src._serializeFields);
return extend.base.apply(this, arguments); return extend.base.apply(this, arguments);
}, },

View file

@ -266,7 +266,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
// compound path forms one shape. // compound path forms one shape.
// Also support legacy format `type: 'path'`. // Also support legacy format `type: 'path'`.
options.class === Path || options.type === 'path' ? options options.class === Path || options.type === 'path' ? options
: new Base(options, { fill: false })); : Base.set({}, options, { fill: false }));
}, },
_draw: function(ctx, param, strokeMatrix) { _draw: function(ctx, param, strokeMatrix) {

View file

@ -90,7 +90,7 @@ var Style = Base.extend(new function() {
selectedColor: null selectedColor: null
}, },
// For TextItem, override default fillColor and add text-specific properties // For TextItem, override default fillColor and add text-specific properties
textDefaults = new Base(defaults, { textDefaults = Base.set({}, defaults, {
fillColor: new Color(), // black fillColor: new Color(), // black
// Characters // Characters
fontFamily: 'sans-serif', fontFamily: 'sans-serif',

View file

@ -408,7 +408,7 @@ var comparators = {
// Cloning SymbolItems does not result in cloned // Cloning SymbolItems does not result in cloned
// SymbolDefinitions // SymbolDefinitions
options && options.cloned options && options.cloned
? new Base(options, { cloned: false }) ? Base.set({}, options, { cloned: false })
: options, : options,
['symbol']); ['symbol']);
}, },