| 87 | )css"; |
| 88 | |
| 89 | UIColorPicker* UIColorPicker::NewModal( Node* nodeCreator, |
| 90 | const UIColorPicker::ColorPickedCb& colorPickedCb, |
| 91 | const Uint8& modalAlpha, const Uint32& winFlags, |
| 92 | const Sizef& winSize ) { |
| 93 | UIColorPicker* colorPicker = NewWindow( colorPickedCb, winFlags, winSize, modalAlpha ); |
| 94 | UIWindow* pickerWin = colorPicker->getUIWindow(); |
| 95 | Sizef windowSize( pickerWin->getSceneNode()->getSize() ); |
| 96 | Sizef nodeSize( nodeCreator->getSize() ); |
| 97 | Vector2f nodePos( nodeCreator->getPosition() ); |
| 98 | nodeCreator->getParent()->nodeToWorld( nodePos ); |
| 99 | nodePos = PixelDensity::pxToDp( nodePos ).ceil(); |
| 100 | |
| 101 | if ( nodePos.y + nodeSize.getHeight() + winSize.getHeight() <= windowSize.getHeight() && |
| 102 | nodePos.x + winSize.getWidth() <= windowSize.getWidth() ) { |
| 103 | pickerWin->setPosition( nodePos.x, nodePos.y + nodeSize.getHeight() ); |
| 104 | } else if ( nodePos.y - winSize.getHeight() >= 0.f && |
| 105 | nodePos.x + winSize.getWidth() <= windowSize.getWidth() ) { |
| 106 | pickerWin->setPosition( nodePos.x, nodePos.y - winSize.getHeight() ); |
| 107 | } else if ( nodePos.y + nodeSize.getHeight() / 2 - winSize.getHeight() / 2 >= 0 && |
| 108 | nodePos.y + nodeSize.getHeight() / 2 - winSize.getHeight() / 2 + |
| 109 | winSize.getHeight() <= |
| 110 | windowSize.getHeight() ) { |
| 111 | if ( nodePos.x - winSize.getWidth() >= 0 ) { |
| 112 | pickerWin->setPosition( nodePos.x - winSize.getWidth(), nodePos.y + |
| 113 | nodeSize.getHeight() / 2 - |
| 114 | winSize.getHeight() / 2 ); |
| 115 | } else if ( nodePos.x + nodeSize.getWidth() + winSize.getWidth() <= |
| 116 | windowSize.getWidth() ) { |
| 117 | pickerWin->setPosition( nodePos.x + nodeSize.getWidth(), nodePos.y + |
| 118 | nodeSize.getHeight() / 2 - |
| 119 | winSize.getHeight() / 2 ); |
| 120 | } else { |
| 121 | pickerWin->center(); |
| 122 | } |
| 123 | } else { |
| 124 | pickerWin->center(); |
| 125 | } |
| 126 | |
| 127 | return colorPicker; |
| 128 | } |
| 129 | |
| 130 | UIColorPicker* UIColorPicker::NewWindow( const ColorPickedCb& colorPickedCb, const Uint32& winFlags, |
| 131 | const Sizef& winSize, const Uint8& modalAlpha ) { |
nothing calls this directly
no test coverage detected