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

Method notifyChangePosition

Tools/EditorFramework/ScopeTextureControl.cpp:282–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280 }
281
282 void ScopeTextureControl::notifyChangePosition(SelectorControl* _sender)
283 {
284 mCoordValue = mCurrentSelectorControl->getCoord();
285
286 // снапим к гриду
287 if (!MyGUI::InputManager::getInstance().isShiftPressed())
288 {
289 MyGUI::IntCoord coord = mCoordValue;
290 MyGUI::IntCoord actionScale = mCurrentSelectorControl->getActionScale();
291
292 if (actionScale.left != 0 && actionScale.width != 0)
293 {
294 int right = coord.right();
295 coord.width = GridManager::getInstance().toGrid(coord.width);
296 coord.left = right - coord.width;
297 }
298 else if (actionScale.width != 0)
299 {
300 int right = GridManager::getInstance().toGrid(coord.right());
301 coord.width = right - coord.left;
302 }
303 else if (actionScale.left != 0)
304 {
305 coord.left = GridManager::getInstance().toGrid(coord.left);
306 }
307
308 if (actionScale.top != 0 && actionScale.height != 0)
309 {
310 int bottom = coord.bottom();
311 coord.height = GridManager::getInstance().toGrid(coord.height);
312 coord.top = bottom - coord.height;
313 }
314 else if (actionScale.height != 0)
315 {
316 int bottom = GridManager::getInstance().toGrid(coord.bottom());
317 coord.height = bottom - coord.top;
318 }
319 else if (actionScale.top != 0)
320 {
321 coord.top = GridManager::getInstance().toGrid(coord.top);
322 }
323
324 if (coord != mCoordValue)
325 {
326 mCoordValue = coord;
327 mCurrentSelectorControl->setCoord(mCoordValue);
328 }
329 }
330
331 setValue(mCoordValue.print());
332 }
333
334 void ScopeTextureControl::onChangeScale()
335 {

Callers

nothing calls this directly

Calls 8

isShiftPressedMethod · 0.80
rightMethod · 0.80
toGridMethod · 0.80
bottomMethod · 0.80
setValueFunction · 0.70
getActionScaleMethod · 0.45
setCoordMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected