DioxusLabs / taffy

A high performance rust-powered UI layout library
https://docs.rs/taffy
Other
2.04k stars 102 forks source link

Fixed print_tree() when rounding is disabled #680

Closed spirali closed 2 months ago

spirali commented 2 months ago

Objective

Fixes .print_tree() method when rounding is disabled. In the original version, if rounding is disabled, .print_tree() just prints zeros.

Original version if rounding is enabled prints:

TREE
└──  FLEX COL [x: 0    y: 0    w: 800  h: 600  content_w: 600  content_h: 300  border: l:0 r:0 t:0 b:0, padding: l:0 r:0 t:0 b:0] (NodeId(4294967299))
    └──  GRID [x: 0    y: 0    w: 600  h: 300  content_w: 300  content_h: 300  border: l:0 r:0 t:0 b:0, padding: l:0 r:0 t:0 b:0] (NodeId(4294967298))
        └──  LEAF [x: 100  y: 150  w: 200  h: 150  content_w: 0    content_h: 0    border: l:0 r:0 t:0 b:0, padding: l:0 r:0 t:0 b:0] (NodeId(4294967297))

Original version if rounding is disabled prints:

TREE
└──  FLEX COL [x: 0    y: 0    w: 0    h: 0    content_w: 0    content_h: 0    border: l:0 r:0 t:0 b:0, padding: l:0 r:0 t:0 b:0] (NodeId(4294967299))
    └──  GRID [x: 0    y: 0    w: 0    h: 0    content_w: 0    content_h: 0    border: l:0 r:0 t:0 b:0, padding: l:0 r:0 t:0 b:0] (NodeId(4294967298))
        └──  LEAF [x: 0    y: 0    w: 0    h: 0    content_w: 0    content_h: 0    border: l:0 r:0 t:0 b:0, padding: l:0 r:0 t:0 b:0] (NodeId(4294967297))

This change prints the first output even rounding is disabled.