| 187 | } |
| 188 | |
| 189 | Rect Helper::convertBoundingBoxToScreen(Node* node) |
| 190 | { |
| 191 | auto director = Director::getInstance(); |
| 192 | auto renderView = director->getRenderView(); |
| 193 | auto frameSize = renderView->getFrameSize(); |
| 194 | |
| 195 | auto winSize = director->getWinSize(); |
| 196 | auto leftBottom = node->convertToWorldSpace(Point::ZERO); |
| 197 | |
| 198 | auto contentSize = node->getContentSize(); |
| 199 | auto rightTop = node->convertToWorldSpace(Point(contentSize.width, contentSize.height)); |
| 200 | |
| 201 | auto uiLeft = frameSize.width / 2 + (leftBottom.x - winSize.width / 2) * renderView->getScaleX(); |
| 202 | auto uiTop = frameSize.height / 2 - (rightTop.y - winSize.height / 2) * renderView->getScaleY(); |
| 203 | auto uiWidth = (rightTop.x - leftBottom.x) * renderView->getScaleX(); |
| 204 | auto uiHeight = (rightTop.y - leftBottom.y) * renderView->getScaleY(); |
| 205 | |
| 206 | return Rect(uiLeft, uiTop, uiWidth, uiHeight); |
| 207 | } |
| 208 | } // namespace ui |
| 209 | |
| 210 | } |
nothing calls this directly
no test coverage detected