tiled 文本位置居中

This commit is contained in:
YHH
2020-08-15 22:24:08 +08:00
parent 23a45bfd2d
commit 1a2dd9ff2a
5 changed files with 12 additions and 8 deletions

View File

@@ -8494,8 +8494,8 @@ var es;
obj.textField.size = 12;
obj.textField.fontFamily = "sans-serif";
if (obj.shape) {
obj.textField.x = pos.x + (obj.shape.width - obj.textField.width) / 2;
obj.textField.y = pos.y - obj.textField.height - 5;
obj.textField.x = pos.x + (obj.shape.getBounds().width - obj.textField.width) / 2 + obj.shape.getBounds().x;
obj.textField.y = pos.y - obj.textField.height - 5 + obj.shape.getBounds().y;
}
else {
obj.textField.x = pos.x + (obj.width - obj.textField.width) / 2;