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
*/
getOptions: function(options) {
return new Base({
return Base.set({
// Type of item, for instanceof check: Group, Layer, Path,
// CompoundPath, Shape, Raster, SymbolItem, ...
type: null,

View file

@ -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);
},

View file

@ -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) {

View file

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

View file

@ -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']);
},