// --------------------------------------------------------------------------- // CAknPointerEventModifier::ModifyEvent // --------------------------------------------------------------------------- // TBool CAknPointerEventModifier::ModifyEvent( TStackItem& aItem, TPointerEvent& aEvent, CCoeControl*& aDestination ) { TBool wasModified = EFalse; // Control window's existence has been checked already in // CAknPointerEventModifier::Push. if ( !aItem.iControl->DrawableWindow()->IsFaded() ) { TBool isVertical = ( aItem.iControl->Size().iHeight > aItem.iControl->Size().iWidth ); if ( aDestination == aItem.iParent ) { // calculate hit area TRect hitArea( aItem.iControl->Position() + aItem.iExtensionArea.iTl, aItem.iExtensionArea.Size() ); TSize controlSize( aItem.iControl->Size() ); if ( hitArea.Contains( aEvent.iPosition ) ) { if ( aItem.iControl->OwnsWindow() ) { aDestination = aItem.iControl; if ( isVertical ) { aEvent.iPosition.iX = controlSize.iWidth >> 1; aEvent.iPosition.iY -= aItem.iControl->Position().iY; } else { aEvent.iPosition.iX -= aItem.iControl->Position().iX; aEvent.iPosition.iY = controlSize.iHeight >> 1; } }
bool SlideNavmesh::mouseDown(const float x, const float y) { if (!m_expanded) { if (hitCorner(x,y)) { startDrag(1, x,y, m_pos); return true; } } else { int bidx = hitButtons(x-m_pos[0],y-m_pos[1]); if (bidx != -1) { return true; } else if (hitCorner(x,y)) { startDrag(1, x,y, m_pos); return true; } else if (hitArea(x,y)) { const float lx = x - (m_pos[0]+PADDING_SIZE); const float ly = y - (m_pos[1]+PADDING_SIZE); float pos[2] = {lx,ly}; float nearest[2] = {lx,ly}; if (m_scene.nav) navmeshFindNearestTri(m_scene.nav, pos, nearest); if (SDL_GetModState() & KMOD_SHIFT) { agentMoveAndAdjustCorridor(&m_scene.agents[0], nearest, m_scene.nav); vcpy(m_scene.agents[0].oldpos, m_scene.agents[0].pos); vset(m_scene.agents[0].corner, FLT_MAX,FLT_MAX); } else { vcpy(m_scene.agents[0].target, nearest); vcpy(m_scene.agents[0].oldpos, m_scene.agents[0].pos); agentFindPath(&m_scene.agents[0], m_scene.nav); vset(m_scene.agents[0].corner, FLT_MAX,FLT_MAX); } return true; } } return false; }