Famous / Famous/engine

Render size width sets width to the longest word

Open
#467 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
249
PR merge metrics
No merged PRs in 30d

Description

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.

``` js
// 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)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.