on master help sign in
Fix bug rendering text fields positioned in a container
eaee137Evan Czaplicki
runtime/Render/Element.js+8−3
@@ -151,7 +151,12 @@ function toPos(pos) {
151
151
152// must clear right, left, top, bottom, and transform
152// must clear right, left, top, bottom, and transform
153// before calling this function
153// before calling this function
154−function setPos(pos,w,h,e) {
154+function setPos(pos,elem,e) {
155+ var element = elem.element;
156+ var props = elem.props;
157+ var w = props.width + (element.adjustWidth ? element.adjustWidth : 0);
158+ var h = props.height + (element.adjustHeight ? element.adjustHeight : 0);
159+
155 e.style.position = 'absolute';
160 e.style.position = 'absolute';
156 e.style.margin = 'auto';
161 e.style.margin = 'auto';
157 var transform = '';
162 var transform = '';
@@ -171,7 +176,7 @@ function setPos(pos,w,h,e) {
171
176
172function container(pos,elem) {
177function container(pos,elem) {
173 var e = render(elem);
178 var e = render(elem);
174− setPos(pos, elem.props.width, elem.props.height, e);
179+ setPos(pos, elem, e);
175 var div = newElement('div');
180 var div = newElement('div');
176 div.style.position = 'relative';
181 div.style.position = 'relative';
177 div.style.overflow = 'hidden';
182 div.style.overflow = 'hidden';
@@ -302,7 +307,7 @@ function update(node, curr, next) {
302 break;
307 break;
303 case "Container":
308 case "Container":
304 update(node.firstChild, currE._1, nextE._1);
309 update(node.firstChild, currE._1, nextE._1);
305− setPos(nextE._0, nextE._1.props.width, nextE._1.props.height, node.firstChild);
310+ setPos(nextE._0, nextE._1, node.firstChild);
306 break;
311 break;
307 case "Custom":
312 case "Custom":
308 if (currE.type === nextE.type) {
313 if (currE.type === nextE.type) {