Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render size width sets width to the longest word #467

Open
michaelobriena opened this issue Aug 12, 2015 · 2 comments
Open

Render size width sets width to the longest word #467

michaelobriena opened this issue Aug 12, 2015 · 2 comments

Comments

@michaelobriena
Copy link
Member

When a node with a DOMElement is marks to be render sized width with content being a string, the width is is determined by the longest individual word. I would imagine that this example would have a single line of text.

// Famous dependencies
var DOMElement = require('famous/dom-renderables/DOMElement');
var FamousEngine = require('famous/core/FamousEngine');
FamousEngine.init();

var scene = FamousEngine.createScene();
var root = scene.addChild();
root
  .setSizeMode(1, 1, 1)
  .setAlign(.5, .5, .5)
  .setMountPoint(.5, .5, .5)
  .setAbsoluteSize(400, 400);

new DOMElement(root, {
  properties: {
    backgroundColor: 'red'
  }
})


var node = root.addChild();
var element = new DOMElement(node, {
  content: 'Hello the following word will determine the width: bananananananana',
  properties: {
    background: 'yellow'
  }
});

node
  .setSizeMode(2, 2)
  .setMountPoint(.5, .5)
  .setAlign(.5, .5)
@alexanderGugel
Copy link
Member

Probably caused by incorrectly setting the initial container size. I remember that we had a similar issue when the root element was detached instead of hidden. This might be a regression.

@michaelobriena
Copy link
Member Author

That is not the case. It has to do with the fact that we need the content div to have position absolute since it would otherwise affect the positioning of children. As such, it stops the div from growing in a strange way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants