Shorten global map marker notes like vanilla (bug #7619)

qt6_macos
Alexei Kotov 4 months ago
parent cf2c6a99a0
commit 14942d7541

@ -96,6 +96,7 @@
Bug #7604: Goblins Grunt becomes idle once injured
Bug #7609: ForceGreeting should not open dialogue for werewolves
Bug #7611: Beast races' idle animations slide after turning or jumping in place
Bug #7619: Long map notes may get cut off
Bug #7630: Charm can be cast on creatures
Bug #7631: Cannot trade with/talk to Creeper or Mudcrab Merchant when they're fleeing
Bug #7636: Animations bug out when switching between 1st and 3rd person, while playing a scripted animation

@ -481,10 +481,13 @@ namespace MWGui
MyGUI::IntCoord(padding.left + 8 + 4, totalSize.height + padding.top, 300 - padding.left - 8 - 4,
300 - totalSize.height),
MyGUI::Align::Default);
edit->setEditMultiLine(true);
edit->setEditWordWrap(true);
edit->setCaption(note);
edit->setSize(edit->getWidth(), edit->getTextSize().height);
constexpr size_t maxLength = 60;
std::string shortenedNote = note.substr(0, std::min(maxLength, note.find('\n')));
if (shortenedNote.size() < note.size())
shortenedNote += " ...";
edit->setCaption(shortenedNote);
MyGUI::IntSize noteTextSize = edit->getTextSize();
edit->setSize(std::max(edit->getWidth(), noteTextSize.width), noteTextSize.height);
icon->setPosition(icon->getLeft(), (edit->getTop() + edit->getBottom()) / 2 - icon->getHeight() / 2);
totalSize.height += std::max(edit->getHeight(), icon->getHeight());
totalSize.width = std::max(totalSize.width, edit->getWidth() + 8 + 4);

Loading…
Cancel
Save