CUIDragItem* CUICellItem::CreateDragItem() { CUIDragItem* tmp; tmp = xr_new<CUIDragItem>(this); Frect r; GetAbsoluteRect(r); if( m_UIStaticItem.GetFixedLTWhileHeading() ) { float w, h; w = r.width(); h = r.height(); if (Heading()) { // исправление пропорций w = w / m_cell_size.x * m_cell_size.y; h = h / m_cell_size.y * m_cell_size.x; } Fvector2 cp = GetUICursor()->GetCursorPosition(); // поворот на 90 градусов, и центрирование по курсору мыша r.x1 = (cp.x - h / 2.0f); r.y1 = (cp.y - w / 2.0f); r.x2 = r.x1 + h; r.y2 = r.y1 + w; } tmp->Init(GetShader(),r,GetUIStaticItem().GetOriginalRect()); return tmp; }
CUIDragItem* CUICellItem::CreateDragItem() { CUIDragItem* tmp; tmp = xr_new<CUIDragItem>(this); Frect r; GetAbsoluteRect(r); if( m_UIStaticItem.GetFixedLTWhileHeading() ) { float t1,t2; t1 = r.width(); t2 = r.height()*UI().get_current_kx(); Fvector2 cp = GetUICursor().GetCursorPosition(); r.x1 = (cp.x-t2/2.0f); r.y1 = (cp.y-t1/2.0f); r.x2 = r.x1 + t2; r.y2 = r.y1 + t1; } tmp->Init(GetShader(), r, GetUIStaticItem().GetTextureRect()); return tmp; }