Skip to content

Commit

Permalink
Moved tranform code
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdove1 committed Aug 16, 2019
1 parent 8dcdc8d commit e2e8f2c
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions source/jquery.canvaswrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,22 @@ don't work unless the canvas is attached to the DOM.

y += 0.75 * info.height;


// update the transforms
if (transforms) {
info.element.transform.baseVal.clear();
transforms.forEach(function(t) {
info.element.transform.baseVal.appendItem(t);
});
}

// Determine whether this text already exists at this position.
// If so, mark it for inclusion in the next render pass.

for (var i = 0, position; positions[i]; i++) {
position = positions[i];
if (position.x === x && position.y === y && position.text === text) {
position.active = true;
// update the transforms
if (transforms) {
info.element.transform.baseVal.clear();
transforms.forEach(function(t) {
info.element.transform.baseVal.appendItem(t);
});
}
return;
} else if (position.active === false) {
position.active = true;
Expand Down Expand Up @@ -436,12 +438,6 @@ don't work unless the canvas is attached to the DOM.
position.element.setAttributeNS(null, 'x', x);
position.element.setAttributeNS(null, 'y', y);
position.element.style.textAlign = halign;

if (transforms) {
transforms.forEach(function(t) {
info.element.transform.baseVal.appendItem(t);
});
}
};

var addTspanElements = function(text, element, x) {
Expand Down

0 comments on commit e2e8f2c

Please sign in to comment.