| 7108 | } |
| 7109 | |
| 7110 | void CEditor::HandleCursorMovement() |
| 7111 | { |
| 7112 | const vec2 UpdatedMousePos = Ui()->UpdatedMousePos(); |
| 7113 | const vec2 UpdatedMouseDelta = Ui()->UpdatedMouseDelta(); |
| 7114 | |
| 7115 | // fix correct world x and y |
| 7116 | const std::shared_ptr<CLayerGroup> pGroup = Map()->SelectedGroup(); |
| 7117 | if(pGroup) |
| 7118 | { |
| 7119 | float aPoints[4]; |
| 7120 | pGroup->Mapping(aPoints); |
| 7121 | |
| 7122 | float WorldWidth = aPoints[2] - aPoints[0]; |
| 7123 | float WorldHeight = aPoints[3] - aPoints[1]; |
| 7124 | |
| 7125 | m_MouseWorldScale = WorldWidth / Graphics()->WindowWidth(); |
| 7126 | |
| 7127 | m_MouseWorldPos.x = aPoints[0] + WorldWidth * (UpdatedMousePos.x / Graphics()->WindowWidth()); |
| 7128 | m_MouseWorldPos.y = aPoints[1] + WorldHeight * (UpdatedMousePos.y / Graphics()->WindowHeight()); |
| 7129 | m_MouseDeltaWorld.x = UpdatedMouseDelta.x * (WorldWidth / Graphics()->WindowWidth()); |
| 7130 | m_MouseDeltaWorld.y = UpdatedMouseDelta.y * (WorldHeight / Graphics()->WindowHeight()); |
| 7131 | } |
| 7132 | else |
| 7133 | { |
| 7134 | m_MouseWorldPos = vec2(-1.0f, -1.0f); |
| 7135 | m_MouseDeltaWorld = vec2(0.0f, 0.0f); |
| 7136 | } |
| 7137 | |
| 7138 | m_MouseWorldNoParaPos = vec2(-1.0f, -1.0f); |
| 7139 | for(const std::shared_ptr<CLayerGroup> &pGameGroup : Map()->m_vpGroups) |
| 7140 | { |
| 7141 | if(!pGameGroup->m_GameGroup) |
| 7142 | continue; |
| 7143 | |
| 7144 | float aPoints[4]; |
| 7145 | pGameGroup->Mapping(aPoints); |
| 7146 | |
| 7147 | float WorldWidth = aPoints[2] - aPoints[0]; |
| 7148 | float WorldHeight = aPoints[3] - aPoints[1]; |
| 7149 | |
| 7150 | m_MouseWorldNoParaPos.x = aPoints[0] + WorldWidth * (UpdatedMousePos.x / Graphics()->WindowWidth()); |
| 7151 | m_MouseWorldNoParaPos.y = aPoints[1] + WorldHeight * (UpdatedMousePos.y / Graphics()->WindowHeight()); |
| 7152 | } |
| 7153 | |
| 7154 | OnMouseMove(UpdatedMousePos); |
| 7155 | } |
| 7156 | |
| 7157 | void CEditor::OnMouseMove(vec2 MousePos) |
| 7158 | { |
nothing calls this directly
no test coverage detected