-
Notifications
You must be signed in to change notification settings - Fork 249
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
Size.RENDER && Content Div #416
Comments
I'm running in to this issue right now, or at least something similar. This seem to happen if the element is hidden when content is added with Here is an example where
A possible work around in this example is setting the display property to
But that only works if all parent nodes are visible too, so that is not always a realistic solution. |
@thejsn I'm not sure that's the same issue... Unfortunately I'm not going to get a chance to debug this until next week, but will also take a look at your issue at the same time and let you know. |
I'm encountering this problem as well. And it is causing a secondary problem: because var child = parent.addChild();
child.el = new famous.domRenderables.DOMElement(child, {
content: 'test'
});
child.setSizeMode(2);
console.log(child.getSize()); // [0, 0, 0]
child.setAlign(1).setMountPoint(1); // content appears outside of parent node |
@JeremySaks I would expect this to happen. You are getting the size before we have written it to the DOM, as such, we have no idea what the render size is. Also, not sure if this is intended, but you are only setting the align and mount point of the X part of the node. |
@michaelobriena that makes sense, and teaches me something basic about node positioning. I don't mean to hijack this thread, but is there a way to effectively work with size mode (Note: I only included the x-axis param in my example in order to simplify it.) |
Origin and mount point do work with render size. RenderSize is just a way of informing the node of how big it is. Beyond that it should work the same in the layout system. |
@michaelobriena I'm still wondering how to dynamically render a DOM element with arbitrary content at the center of parent node. Is there a known solution for that? |
// 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',
properties: {
background: 'yellow'
}
});
node
.setSizeMode(2, 2)
.setMountPoint(.5, .5)
.setAlign(.5, .5) There is an issue we are working through in regards to words auto moing down a line but this is the idea. |
@michaelobriena Thanks, I didn't know positioning issue for render size was fixed in v0.7. I'm glad it's almost working now except this word splitting bug. Is there an issue we can track for this bug? |
There was at one point but I was actually looking for it earlier today and could not find it. I will start one. |
@michaelobriena Thanks for opening issue #467 |
@JeremySaks If you want to get the size of a Render Node you need to add a component onSizeChange: Following an example that works for me:
|
When you set the size mode
Size.RENDER
and place textual content into theNode
usingNode.setContent
, the size of the nested content div is not updated with the render size.Will try to work up an example tomorrow. I was doing something dumb when I encoutered this (trying to set a max height on a
Size.RENDER
so thattext-overflow
works, should just set an absolute height), so I don't know how critical this is or if folks will run into this for real...The text was updated successfully, but these errors were encountered: