| 1212 | if (viewNodeTree == nullptr || runtimeWrapper == nullptr) { |
| 1213 | return; |
| 1214 | } |
| 1215 | |
| 1216 | if (static_cast<bool>(shouldUnset)) { |
| 1217 | viewNodeTree->setViewport(std::nullopt); |
| 1218 | } else { |
| 1219 | auto pointScale = runtimeWrapper->getPointScale(); |
| 1220 | auto xFloat = static_cast<float>(x) / pointScale; |
| 1221 | auto yFloat = static_cast<float>(y) / pointScale; |
| 1222 | auto widthFloat = static_cast<float>(width) / pointScale; |
| 1223 | auto heightFloat = static_cast<float>(height) / pointScale; |
| 1224 | |
| 1225 | viewNodeTree->setViewport({Valdi::Frame(xFloat, yFloat, widthFloat, heightFloat)}); |
| 1226 | } |
| 1227 | } |