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

[JS][notice me senpai ◕‿◕] child node position not being set #57

Open
jeebus3000 opened this issue Sep 17, 2019 · 0 comments
Open

Comments

@jeebus3000
Copy link

Hello!
I "ported" rust test -- https://github.com/vislyhq/stretch/blob/master/tests/generated/absolute_layout_align_items_center_on_child_only.rs to JS (I believe, I made it correctly)

import { Allocator, Node, AlignSelf, PositionType } from 'stretch-layout';

const allocator = new Allocator();

const node = new Node(allocator, {
    width: 110,
    height: 100,
});

const childNode = new Node(allocator, {
    width: 60,
    height: 40,
    alignSelf: AlignSelf.Center,
    positionType: PositionType.Absolute
});

node.addChild(childNode);

const layout = node.computeLayout(), childLayout = childNode.computeLayout();

console.log(layout.width, layout.height, layout.x, layout.y);
console.log(childLayout.width, childLayout.height, childLayout.x, childLayout.y);

In browser (both FF & Chrome) console I get:

110 100 0 0
60 40 0 0

According to assert_eq!(stretch.layout(node0).unwrap().location.y, 30f32); -- childNode y should be 30 px. I also tried other tests, but no luck either.

@jeebus3000 jeebus3000 changed the title [JS] child node position not being set [JS][notice me senpai ◕‿◕] child node position not being set Oct 9, 2019
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

1 participant