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

Adding length of a wall in properties #211

Closed
chinyart opened this issue Nov 24, 2020 · 2 comments
Closed

Adding length of a wall in properties #211

chinyart opened this issue Nov 24, 2020 · 2 comments

Comments

@chinyart
Copy link

chinyart commented Nov 24, 2020

Hi, for some reason i can't seem to find the length of a wall, except for the height and width, but when i select an element to edit the property, i am able to see it there
Below is an property object of a wall when i log state in the console:
IMG_20201125_003359
As You can see the width is missing for a wall.

Please how can i add the width of a wall or modify the property of any item to have a complete property as i want, Thank you in advance.

@chinyart chinyart changed the title Adding length of an element in properties Adding length of a wall in properties Nov 24, 2020
@danilosalvati
Copy link
Member

Hi @chinyart you can use coordinates (using the vertices list) to compute the length of the wall

@chinyart
Copy link
Author

chinyart commented Nov 25, 2020

Hi @danilosalvati, thank you for your quick response, i really appreciate it, i followed your advice and found this snippet to be used somewhere to get lineLength.

I made use of this method to get the width:

var x1, x2, y1, y2;
var vertices = this.props.state.getIn(['scene', 'layers', _obj, 'lines', childProperties.id, 'vertices']);

var _state$getIn2 = this.props.state.getIn(['scene', 'layers', _obj, 'vertices', vertices.get(0)]),
x1 = _state$getIn2.x,
y1 = _state$getIn2.y;

var _state$getIn3 = this.props.state.getIn(['scene', 'layers', _obj, 'vertices', vertices.get(1)]),
x2 = _state$getIn3.x,
y2 = _state$getIn3.y;

var width = GeometryUtils.pointsDistance(x1, y1, x2, y2);

Vertices as a variable is not empty, but i get an undefined error on vertices.get(0)
please what am i doing wrong from the snippet above and what should i do instead?, thank you in advance.

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