MCPcopy Create free account
hub / github.com/MyGUI/mygui / notifyMouseDrag

Method notifyMouseDrag

Tools/LayoutEditor/SeparatorPartControl.cpp:44–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 }
43
44 void SeparatorPartControl::notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
45 {
46 if (_id == MyGUI::MouseButton::Left)
47 {
48 MyGUI::IntPoint mousePosition = MyGUI::InputManager::getInstance().getMousePosition();
49 int delta = mousePosition.left - mStartMousePosition.left;
50
51 MyGUI::IntCoord leftPanel = mStartLeftPanel;
52 MyGUI::IntCoord rightPanel = mStartRightPanel;
53 MyGUI::IntCoord separatorHPanel = mStartSeparatorH;
54
55 leftPanel.width += delta;
56 separatorHPanel.left += delta;
57 rightPanel.left += delta;
58 rightPanel.width -= delta;
59
60 int diffLeft = mMinSizeLeft - leftPanel.width;
61 if (diffLeft > 0)
62 {
63 leftPanel.width += diffLeft;
64 separatorHPanel.left += diffLeft;
65 rightPanel.left += diffLeft;
66 rightPanel.width -= diffLeft;
67 }
68
69 int diffRight = mMinSizeRight - rightPanel.width;
70 if (diffRight > 0)
71 {
72 leftPanel.width -= diffRight;
73 separatorHPanel.left -= diffRight;
74 rightPanel.left -= diffRight;
75 rightPanel.width += diffRight;
76 }
77
78 mLeftPanel->setCoord(leftPanel);
79 mRightPanel->setCoord(rightPanel);
80 mSeparatorH->setCoord(separatorHPanel);
81 }
82 }
83
84}

Callers

nothing calls this directly

Calls 2

getMousePositionMethod · 0.45
setCoordMethod · 0.45

Tested by

no test coverage detected