textPath with transform

master
Mark MacKay 2021-07-20 12:51:48 -05:00
parent f602848cba
commit 56b57cd0ec
2 changed files with 8 additions and 7 deletions

View File

@ -128,11 +128,12 @@ svgedit.select.Selector.prototype.showGrips = function(show) {
var elem = this.selectedElement;
this.hasGrips = show;
if(elem && show) {
const isText = elem.tagName === "text";
const grips = selectorManager_.selectorGrips;
["n", "s", "e", "w"].forEach(dir => {
grips[dir].style.display = isText ? "none" : "inline";
});
// hide unproportional scale grips
// const isText = elem.tagName === "text";
// const grips = selectorManager_.selectorGrips;
// ["n", "s", "e", "w"].forEach(dir => {
// grips[dir].style.display = isText ? "none" : "inline";
// });
this.selectorGroup.appendChild(selectorManager_.selectorGripsGroup);
this.updateGripCursors(svgedit.utilities.getRotationAngle(elem));
}

View File

@ -971,7 +971,6 @@ var remapElement = this.remapElement = function(selected,changes,m) {
}
}
var elName = selected.tagName;
if(elName === "g" || elName === "text" || elName === "use") {
// if it was a translate, then just update x,y
@ -2747,7 +2746,7 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
translateOrigin.setTranslate(-(left+tx),-(top+ty));
}
if(evt.shiftKey || selected.tagName === "text") {
if(evt.shiftKey) {
if(sx == 1) sx = sy
else sy = sx;
}
@ -7523,6 +7522,7 @@ this.textPath = function(){
const textPath = svgdoc.createElementNS(svgns, "textPath");
textPath.textContent = text.textContent;
text.textContent = "";
text.removeAttribute("transform");
text.setAttribute("text-anchor", "middle");
text.setAttribute("x", 0);
text.setAttribute("y", 0);