Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(): move getTopContext #7711

Merged
merged 5 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/canvas.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 5 additions & 0 deletions test/unit/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down