Skip to content

Commit

Permalink
fix(dom): convert layout result nan to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
ilikethese committed Dec 15, 2023
1 parent dd2320d commit 419f11d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dom/src/dom/dom_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@ void DomNode::TransferLayoutOutputsRecursive(std::vector<std::shared_ptr<DomNode
not_equal(layout_.left, layout_node_->GetLeft()) || not_equal(layout_.top, layout_node_->GetTop()) ||
not_equal(layout_.width, layout_node_->GetWidth()) || not_equal(layout_.height, layout_node_->GetHeight());

layout_.left = layout_node_->GetLeft();
layout_.top = layout_node_->GetTop();
layout_.width = layout_node_->GetWidth();
layout_.height = layout_node_->GetHeight();
layout_.left = std::isnan(layout_node_->GetLeft()) ? 0 : layout_node_->GetLeft();
layout_.top = std::isnan(layout_node_->GetTop()) ? 0 : layout_node_->GetTop();
layout_.width = std::isnan(layout_node_->GetWidth()) ? 0 : layout_node_->GetWidth();
layout_.height = std::isnan(layout_node_->GetHeight()) ? 0 : layout_node_->GetHeight();
layout_.marginLeft = layout_node_->GetMargin(Edge::EdgeLeft);
layout_.marginTop = layout_node_->GetMargin(Edge::EdgeTop);
layout_.marginRight = layout_node_->GetMargin(Edge::EdgeRight);
Expand Down

0 comments on commit 419f11d

Please sign in to comment.