| 196 | } |
| 197 | |
| 198 | void VisualDictionaryApp::selectNode( list<WordNode>::iterator selectedNode ) |
| 199 | { |
| 200 | // have all the nodes but this one disappear |
| 201 | for( list<WordNode>::iterator nodeIt = mNodes.begin(); nodeIt != mNodes.end(); ++nodeIt ) { |
| 202 | if( nodeIt != selectedNode ) { |
| 203 | // copy this node to dying nodes and erase it from the current |
| 204 | mDyingNodes.push_back( *nodeIt ); |
| 205 | timeline().apply( &mDyingNodes.back().mRadius, 0.0f, 0.5f, EaseInQuint() ) |
| 206 | .finishFn( bind( &WordNode::setShouldBeDeleted, &(mDyingNodes.back()) ) ); // when you're done, mark yourself for deletion |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | mCurrentNode = *selectedNode; |
| 211 | mCurrentNode.setSelected(); |
| 212 | mNodes.clear(); |
| 213 | |
| 214 | Color c = Color( mCurrentNode.mColor().r, mCurrentNode.mColor().g, mCurrentNode.mColor().b ); |
| 215 | vec2 dirToCenter = ( mCurrentNode.mPos() - getWindowCenter() ) * 0.5f; |
| 216 | |
| 217 | timeline().add( bind( &CenterState::addCircle, &mCenterState, mCurrentNode.getWord(), c, dirToCenter * 0.2f ), timeline().getCurrentTime() + 0.25f ); |
| 218 | |
| 219 | // move the selected node towards the center |
| 220 | |
| 221 | timeline().apply( &mCurrentNode.mPos, getWindowCenter() + dirToCenter, 0.3f, EaseInQuint() ); |
| 222 | timeline().apply( &mCurrentNode.mColor, ColorA( mCurrentNode.mColor().r, mCurrentNode.mColor().g, mCurrentNode.mColor().b, 0.0f ), 0.3f, EaseInAtan( 10 ) ); |
| 223 | |
| 224 | // now add all the descendants of the clicked node |
| 225 | vector<string> children( mDictionary->getDescendants( mCurrentNode.getWord() ) ); |
| 226 | layoutWords( children, getLayoutRadius() ); |
| 227 | |
| 228 | // mark our currently highlighted node as "none" |
| 229 | mMouseOverNode = mNodes.end(); |
| 230 | |
| 231 | // once everything is done animating, then we can allow selections, but for now, disable them |
| 232 | mEnableSelections = false; |
| 233 | std::function<void()> cueAction = bind( &VisualDictionaryApp::enableSelections, this ); |
| 234 | timeline().add( cueAction, timeline().getEndTime() - 2.0f ); |
| 235 | } |
| 236 | |
| 237 | void VisualDictionaryApp::update() |
| 238 | { |
nothing calls this directly
no test coverage detected