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

Method notifyMouseDrag

Demos/Demo_Colour/ColourPanel.cpp:104–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102 }
103
104 void ColourPanel::notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
105 {
106 if (_id != MyGUI::MouseButton::Left)
107 return;
108
109 MyGUI::Widget* parent = mImageColourPicker->getParent();
110 MyGUI::IntPoint point(_left - parent->getAbsoluteLeft(), _top - parent->getAbsoluteTop());
111
112 if (point.left < 0)
113 point.left = 0;
114 if (point.top < 0)
115 point.top = 0;
116 if (point.left > mColourRect->getWidth())
117 point.left = mColourRect->getWidth();
118 if (point.top > mColourRect->getHeight())
119 point.top = mColourRect->getHeight();
120
121 mImageColourPicker->setPosition(
122 point.left - (mImageColourPicker->getWidth() / 2),
123 point.top - (mImageColourPicker->getHeight() / 2));
124
125 updateFromPoint(point);
126 }
127
128 void ColourPanel::notifyMouseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
129 {

Callers

nothing calls this directly

Calls 4

getParentMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected