diff --git a/src/shapes/object.class.js b/src/shapes/object.class.js index 633ead8386e..50bbf3f7409 100644 --- a/src/shapes/object.class.js +++ b/src/shapes/object.class.js @@ -1777,7 +1777,7 @@ * @return {Boolean} */ isType: function(type) { - return this.type === type; + return arguments.length > 1 ? Array.from(arguments).includes(this.type) : this.type === type; }, /** diff --git a/test/unit/object.js b/test/unit/object.js index ec67dbe3d38..855b64f9d55 100644 --- a/test/unit/object.js +++ b/test/unit/object.js @@ -494,6 +494,8 @@ cObj = new fabric.Rect(); assert.ok(cObj.isType('rect')); assert.ok(!cObj.isType('object')); + assert.ok(cObj.isType('object', 'rect')); + assert.ok(!cObj.isType('object', 'circle')); }); QUnit.test('toggle', function(assert) {