diff --git a/src/canvas.class.js b/src/canvas.class.js index 2b3a2c1857a..aaed35a306b 100644 --- a/src/canvas.class.js +++ b/src/canvas.class.js @@ -990,8 +990,17 @@ toEl.style.cssText = fromEl.style.cssText; }, + /** + * Returns context of top canvas where interactions are drawn + * @returns {CanvasRenderingContext2D} + */ + getTopContext: function () { + return this.contextTop; + }, + /** * Returns context of canvas where object selection is drawn + * @alias * @return {CanvasRenderingContext2D} */ getSelectionContext: function() { diff --git a/test/unit/canvas.js b/test/unit/canvas.js index b618c32dbff..f7e5f20090c 100644 --- a/test/unit/canvas.js +++ b/test/unit/canvas.js @@ -2520,6 +2520,11 @@ assert.ok(typeof InheritedCanvasClass === 'function'); }); + + QUnit.test('canvas getTopContext', function(assert) { + assert.ok(typeof canvas.getTopContext === 'function'); + assert.equal(canvas.getTopContext(), canvas.contextTop, 'it jsut returns contextTop'); + }); QUnit.test('_shouldCenterTransform', function(assert) { assert.equal(