diff --git a/src/MapEditor/Edit/Input.cpp b/src/MapEditor/Edit/Input.cpp index c2828e7bf..c20bdb4bf 100644 --- a/src/MapEditor/Edit/Input.cpp +++ b/src/MapEditor/Edit/Input.cpp @@ -97,7 +97,7 @@ bool Input::mouseMove(int new_x, int new_y) double my = context_.snapToGrid(mouse_pos_map_.y, false); string status_text; if (context_.mapDesc().format == MAP_UDMF) - status_text = S_FMT("Position: (%1.3f, %1.3f)", mx, my); + status_text = S_FMT("Position: (%1.1f, %1.1f)", mx, my); else status_text = S_FMT("Position: (%d, %d)", (int)mx, (int)my); MapEditor::setStatusText(status_text, 3); diff --git a/src/MapEditor/Renderer/Overlays/LineInfoOverlay.cpp b/src/MapEditor/Renderer/Overlays/LineInfoOverlay.cpp index f4b5bc1fb..2a6eb391b 100644 --- a/src/MapEditor/Renderer/Overlays/LineInfoOverlay.cpp +++ b/src/MapEditor/Renderer/Overlays/LineInfoOverlay.cpp @@ -89,7 +89,8 @@ void LineInfoOverlay::update(MapLine* line) info_text += (S_FMT("Line #%d (%d)\n", line->getIndex(), line->getId())); else info_text += (S_FMT("Line #%d\n", line->getIndex())); - info_text += (S_FMT("Length: %d\n", MathStuff::round(line->getLength()))); + info_text += (S_FMT("Length: %1.2f\n", line->getLength())); + info_text += (S_FMT("Angle: %1.2f\n", line->getAngle())); // Line special int as_id = line->intProperty("special"); diff --git a/src/MapEditor/SLADEMap/MapLine.cpp b/src/MapEditor/SLADEMap/MapLine.cpp index ded152c88..2aca578d3 100644 --- a/src/MapEditor/SLADEMap/MapLine.cpp +++ b/src/MapEditor/SLADEMap/MapLine.cpp @@ -493,6 +493,18 @@ double MapLine::getLength() return length; } +/* MapLine::getAngle + * Returns the angle (in degrees) of line, east is zero, front side counter-clock wise. + *******************************************************************/ +double MapLine::getAngle() +{ + if (!vertex1 || !vertex2) + return -1; + double angle = (180.0 / M_PI) * atan2(vertex1->yPos() - vertex2->yPos(), vertex1->xPos() - vertex2->xPos()); + if (angle < 0) angle += 360.0; + return angle; +} + /* MapLine::doubleSector * Returns true if the line has the same sector on both sides *******************************************************************/ diff --git a/src/MapEditor/SLADEMap/MapLine.h b/src/MapEditor/SLADEMap/MapLine.h index b4244af15..8ca3f908a 100644 --- a/src/MapEditor/SLADEMap/MapLine.h +++ b/src/MapEditor/SLADEMap/MapLine.h @@ -115,6 +115,7 @@ class MapLine : public MapObject fpoint2_t point2(); fseg2_t seg(); double getLength(); + double getAngle(); bool doubleSector(); fpoint2_t frontVector(); fpoint2_t dirTabPoint(double length = 0); diff --git a/src/MapEditor/UI/MapEditorWindow.cpp b/src/MapEditor/UI/MapEditorWindow.cpp index 8dcf86ee2..0532ffa3e 100644 --- a/src/MapEditor/UI/MapEditorWindow.cpp +++ b/src/MapEditor/UI/MapEditorWindow.cpp @@ -322,7 +322,7 @@ void MapEditorWindow::setupLayout() // Status bar CreateStatusBar(4); - int status_widths[4] = { -1, 240, 200, 160 }; + int status_widths[4] = { -1, 240, 200, 300 }; SetStatusWidths(4, status_widths); // -- Console Panel -- diff --git a/src/UI/STopWindow.cpp b/src/UI/STopWindow.cpp index 7fc28f38d..60ce6b01a 100644 --- a/src/UI/STopWindow.cpp +++ b/src/UI/STopWindow.cpp @@ -208,7 +208,7 @@ void STopWindow::removeAllCustomToolBars() // ---------------------------------------------------------------------------- void STopWindow::populateToolbarsMenu() const { - while (toolbar_menu_->FindItemByPosition(0)) + while (toolbar_menu_->GetMenuItemCount()) toolbar_menu_->Delete(toolbar_menu_->FindItemByPosition(0)); for (auto a = 0u; a < toolbar_->groups().size(); ++a)