PDF Editor: Set width after text

This commit is contained in:
Raphael Michel
2023-04-05 17:51:34 +02:00
parent ff043e98f3
commit 33fc752a5f

View File

@@ -246,7 +246,6 @@ var editor = {
o.setFontFamily(d.fontfamily); o.setFontFamily(d.fontfamily);
o.setFontWeight(d.bold ? 'bold' : 'normal'); o.setFontWeight(d.bold ? 'bold' : 'normal');
o.setFontStyle(d.italic ? 'italic' : 'normal'); o.setFontStyle(d.italic ? 'italic' : 'normal');
o.setWidth(editor._mm2px(d.width));
o.downward = d.downward || false; o.downward = d.downward || false;
o.content = d.content; o.content = d.content;
o.setTextAlign(d.align); o.setTextAlign(d.align);
@@ -261,6 +260,7 @@ var editor = {
} else if (d.content) { } else if (d.content) {
o.setText(editor._get_text_sample(d.content)); o.setText(editor._get_text_sample(d.content));
} }
o.setWidth(editor._mm2px(d.width)); // needs to be after setText
if (d.locale) { if (d.locale) {
// The data format allows to set the locale per text field but we currently only expose a global field // The data format allows to set the locale per text field but we currently only expose a global field
$("#pdf-info-locale").val(d.locale); $("#pdf-info-locale").val(d.locale);
@@ -610,7 +610,6 @@ var editor = {
if (align) { if (align) {
o.setTextAlign(align); o.setTextAlign(align);
} }
o.setWidth(editor._mm2px($("#toolbox-textwidth").val()));
o.downward = $("#toolbox").find("button[data-action=downward]").is('.active'); o.downward = $("#toolbox").find("button[data-action=downward]").is('.active');
o.rotate(parseFloat($("#toolbox-textrotation").val())); o.rotate(parseFloat($("#toolbox-textrotation").val()));
$("#toolbox-content-other").toggle($("#toolbox-content").val() === "other"); $("#toolbox-content-other").toggle($("#toolbox-content").val() === "other");
@@ -636,6 +635,7 @@ var editor = {
} else { } else {
o.setText(editor._get_text_sample($("#toolbox-content").val())); o.setText(editor._get_text_sample($("#toolbox-content").val()));
} }
o.setWidth(editor._mm2px($("#toolbox-textwidth").val()));
} }
// empty text-inputs if not in use // empty text-inputs if not in use