Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // [GUIButton::setFromStyles()] If button is hovered, scaleup it multiplying by SCALEUP_HOVERED_MOD
- infostream << "Checking for \'scaleup_hovered\' availability...\n";
- if (style.isNotDefault(StyleSpec::SCALEUP_HOVERED)) {
- infostream << "\'scaleup_hovered\' element is set!\n";
- infostream << "Current button size:\n";
- infostream << "UpperLeftCorner: (" << AbsoluteRect.UpperLeftCorner.X << ", " << AbsoluteRect.UpperLeftCorner.Y << ")\n";
- infostream << "LowerRightCorner: (" << AbsoluteRect.LowerRightCorner.X << ", " << AbsoluteRect.LowerRightCorner.Y << ")\n";
- if (prev_rect_size.capacity() == 0)
- prev_rect_size.resize(2);
- if (hovered) {
- infostream << "The element has been hovered!\n";
- infostream << typeid(prev_rect_size[1]).name() << "\n";
- infostream << typeid(AbsoluteRect.UpperLeftCorner).name() << "\n";
- prev_rect_size.at(0) = AbsoluteRect.UpperLeftCorner;
- infostream << "1\n";
- prev_rect_size.at(1) = AbsoluteRect.LowerRightCorner;
- infostream << "2\n";
- AbsoluteRect.UpperLeftCorner.X *= SCALEUP_HOVERED_MOD;
- infostream << "3\n";
- AbsoluteRect.UpperLeftCorner.Y *= SCALEUP_HOVERED_MOD;
- AbsoluteRect.LowerRightCorner.X *= SCALEUP_HOVERED_MOD;
- AbsoluteRect.LowerRightCorner.Y *= SCALEUP_HOVERED_MOD;
- updateAbsolutePosition();
- /*rect_size[1] = v2f(
- rect_size[1].X*SCALEUP_HOVERED_MOD,
- rect_size[1].Y*SCALEUP_HOVERED_MOD
- );
- rect_size[2] = v2f(
- rect_size[2].X*SCALEUP_HOVERED_MOD,
- rect_size[2].Y*SCALEUP_HOVERED_MOD
- );
- std::vector<v2f> rect_size = getAbsoluteRectSize();
- prev_rect_size = rect_size;
- setAbsoluteRectSize(
- rect_size[1].X*SCALEUP_HOVERED_MOD,
- rect_size[1].Y*SCALEUP_HOVERED_MOD,
- rect_size[2].X*SCALEUP_HOVERED_MOD,
- rect_size[2].Y*SCALEUP_HOVERED_MOD
- );*/
- infostream << "Current button size (after hovering):\n";
- infostream << "UpperLeftCorner: (" << AbsoluteRect.UpperLeftCorner.X << ", " << AbsoluteRect.UpperLeftCorner.Y << ")\n";
- infostream << "LowerRightCorner: (" << AbsoluteRect.LowerRightCorner.X << ", " << AbsoluteRect.LowerRightCorner.Y << ")\n";
- }
- else if (!hovered && !prev_rect_size.empty()) {
- infostream << "The element has been released!\n";
- // Get back the previous saved size for the button
- AbsoluteRect.UpperLeftCorner.X = prev_rect_size.at(0).X;
- AbsoluteRect.UpperLeftCorner.Y = prev_rect_size.at(0).Y;
- AbsoluteRect.LowerRightCorner.X = prev_rect_size.at(1).X;
- AbsoluteRect.LowerRightCorner.Y = prev_rect_size.at(1).Y;
- updateAbsolutePosition();
- prev_rect_size.clear();
- /*setAbsoluteRectSize(
- prev_rect_size[1].X,
- prev_rect_size[1].Y,
- prev_rect_size[2].X,
- prev_rect_size[2].Y
- );
- prev_rect_size.clear();*/
- infostream << "Current button size (after releasing):\n";
- infostream << "UpperLeftCorner: (" << AbsoluteRect.UpperLeftCorner.X << ", " << AbsoluteRect.UpperLeftCorner.Y << ")\n";
- infostream << "LowerRightCorner: (" << AbsoluteRect.LowerRightCorner.X << ", " << AbsoluteRect.LowerRightCorner.Y << ")\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement