Skip to content

Commit

Permalink
multi-line text box size to 200
Browse files Browse the repository at this point in the history
  • Loading branch information
chanlee committed Feb 4, 2016
1 parent 6907f93 commit 3db76d4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
15 changes: 2 additions & 13 deletions dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7235,20 +7235,9 @@ Entry.EntryObject.prototype.initEntity = function(a) {
b.height = c.height;
} else {
if ("textBox" == this.objectType) {
if (b.regX = 25, b.regY = 12, b.scaleX = b.scaleY = 1.5, b.width = 50, b.height = 24, b.text = a.name, a.options) {
if (b.regX = 25, b.regY = 12, b.scaleX = b.scaleY = 1.5, b.width = 50, b.height = 24, b.text = a.text, a.options) {
if (a = a.options, c = "", a.bold && (c += "bold "), a.italic && (c += "italic "), b.underline = a.underline, b.strike = a.strike, b.font = c + "20px " + a.font.family, b.colour = a.colour, b.bgColor = a.background, b.lineBreak = a.lineBreak) {
a = b.text.split("\n");
if (1 < a.length) {
for (var c = a[0].length, d = 1, e = a.length;d < e;d++) {
a[d].length > c && (c = a[d].length);
}
b.width = 25 * c;
b.height = 24 * a.length;
} else {
b.width = 25 * b.text.length;
}
b.regX = b.width / 2;
b.regY = b.height / 2;
b.width = 256, b.height = .5625 * b.width, b.regX = b.width / 2, b.regY = b.height / 2;
}
} else {
b.underline = !1, b.strike = !1, b.font = "20px Nanum Gothic", b.colour = "#000000", b.bgColor = "#ffffff";
Expand Down
6 changes: 3 additions & 3 deletions dist/entry.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions src/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ Entry.EntryObject.prototype.initEntity = function(model) {
json.scaleX = json.scaleY = 1.5;
json.width = 50;
json.height = 24;
json.text = model.name;
json.text = model.text;
if (model.options) {
var options = model.options;
var fontStyle = '';
Expand All @@ -867,19 +867,28 @@ Entry.EntryObject.prototype.initEntity = function(model) {
json.bgColor = options.background;
json.lineBreak = options.lineBreak;
if (options.lineBreak) {
/*
var lines = json.text.split('\n');
if (lines.length > 1) {
var maxLen = lines[0].length;
var maxHeight = lines.length;
for(var i=1,len=lines.length;i<len;i++) {
if (lines[i].length > maxLen) {
maxLen = lines[i].length;
}
}
json.width = 25 * maxLen;
json.height = 24 * lines.length;
if (maxLen > 20) maxLen= 20;
if (maxHeight > 3) maxHeight = 3;
json.width = 20 * maxLen;
json.height = 35 * maxHeight;
} else {
json.width = 25 * json.text.length;
json.width = 20 * json.text.length;
json.height = 35;
}
*/
json.width = 256;
json.height = json.width * 0.5625;
json.regX = json.width / 2;
json.regY = json.height / 2;
}
Expand Down

0 comments on commit 3db76d4

Please sign in to comment.