| 241 | } |
| 242 | |
| 243 | void TextureControlLE::loadMouseRelative() |
| 244 | { |
| 245 | MyGUI::IntCoord viewCoord = mView->getViewCoord(); |
| 246 | MyGUI::IntSize canvasSize = mView->getCanvasSize(); |
| 247 | MyGUI::IntPoint mousePoint = MyGUI::InputManager::getInstance().getMousePositionByLayer(); |
| 248 | |
| 249 | // смещение мыши относительно вью |
| 250 | MyGUI::IntPoint mouseOffset = mousePoint - mView->getAbsolutePosition() - viewCoord.point(); |
| 251 | // смещение нужной точки внутри текстуры в пикселях |
| 252 | MyGUI::IntPoint canvasPointOffset( |
| 253 | (int)(mMouseRelative.left * (float)canvasSize.width), |
| 254 | (int)(mMouseRelative.top * (float)canvasSize.height)); |
| 255 | // смещение вью в пикселях |
| 256 | MyGUI::IntPoint canvasOffset = canvasPointOffset - mouseOffset; |
| 257 | |
| 258 | mView->setViewOffset(MyGUI::IntPoint(-canvasOffset.left, -canvasOffset.top)); |
| 259 | } |
| 260 | |
| 261 | MyGUI::IntPoint TextureControlLE::getMousePosition() |
| 262 | { |
nothing calls this directly
no test coverage detected