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

Canvas track matte issue with older format #3034

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion player/js/elements/canvasElements/CVBaseElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ CVBaseElement.prototype = {
this.clearCanvas(this.canvasContext);
this.canvasContext.setTransform(this.currentTransform);
// We draw the mask
const mask = this.comp.getElementById('tp' in this.data ? this.data.tp : this.data.ind - 1);
const mask = ('tp' in this.data)
? this.comp.getElementById(this.data.tp)
: this.comp.getElementByRelativePos(this, -1);
mask.renderFrame(true);
// We draw the second buffer (that contains the content of this layer)
this.canvasContext.setTransform(1, 0, 0, 1, 0, 0);
Expand Down
12 changes: 12 additions & 0 deletions player/js/renderers/BaseRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ BaseRenderer.prototype.getElementById = function (ind) {
return null;
};

BaseRenderer.prototype.getElementByRelativePos = function (element, relativeIndex) {
var i;
var len = this.elements.length;
for (i = 0; i < len; i += 1) {
if (this.elements[i] === element && this.elements[i + relativeIndex]) {
return this.elements[i + relativeIndex];
}
}
// Returning element in index 0 to avoid errors
return this.elements[0];
};

BaseRenderer.prototype.getElementByPath = function (path) {
var pathValue = path.shift();
var element;
Expand Down