| 248 | } |
| 249 | |
| 250 | AlignNode::AlignNode(bool isWindowRoot) { |
| 251 | if (isWindowRoot) { |
| 252 | setSize(SharedApplication.getVisualSize()); |
| 253 | float scale = SharedApplication.getDevicePixelRatio(); |
| 254 | setScaleX(scale); |
| 255 | setScaleY(scale); |
| 256 | gslot("AppChange"_slice, [this](Event* e) { |
| 257 | std::string settingName; |
| 258 | if (!e->get(settingName)) return; |
| 259 | if (settingName != "Size"sv) return; |
| 260 | setSize(SharedApplication.getVisualSize()); |
| 261 | float scale = SharedApplication.getDevicePixelRatio(); |
| 262 | setScaleX(scale); |
| 263 | setScaleY(scale); |
| 264 | YGNodeStyleSetWidth(_yogaNode, getWidth()); |
| 265 | YGNodeStyleSetHeight(_yogaNode, getHeight()); |
| 266 | YGNodeCalculateLayout(_yogaNode, YGUndefined, YGUndefined, YGDirectionLTR); |
| 267 | alignLayout(); |
| 268 | }); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | bool AlignNode::init() { |
| 273 | if (!Node::init()) return false; |
no test coverage detected