void ToolWindowManager::setToolWindowProperties(QWidget *toolWindow, ToolWindowManager::ToolWindowProperty properties) { m_toolWindowProperties[toolWindow] = properties; ToolWindowManagerArea *area = areaOf(toolWindow); if(area) area->updateToolWindow(toolWindow); }
bool Rect::pointInRect(const vec::Vector2& point, vec::Vector2& normal) const { //float rSum = tl.dist(tr) * tl.dist(bl); float rSum = areaOf(tl, tr, bl) + areaOf(tr, br, bl); float a1 = areaOf(tl, point, bl); float a2 = areaOf(bl, point, br); float a3 = areaOf(br, point, tr); float a4 = areaOf(point, tr, tl); float pSum = a1 + a2 + a3 + a4; if (pSum - rSum > 2) return false; // Figure out which line is being intersected with vec::Vector2 p1, p2; float minArea = minVal(a1, a2, a3, a4); if (minArea == a1) { p1 = tl; p2 = bl; } else if (minArea == a2) { p1 = bl; p2 = br; } else if (minArea == a3) { p1 = br; p2 = tr; } else if (minArea == a4) { p1 = tr; p2 = tl; } // Calculate the normal of this line normal = (p1 - p2).rotate(PI / 2).setMag(1); normal *= -1; // Make sure the normal is pointing outwards vec::Vector2 difC = point - this->getPos(); if (normal.angleBetween(difC) > 90) normal *= -1; return true; }
bool Rect::pointInRect(const vec::Vector2& point) const { bool colliding = true; //float rSum = tl.dist(tr) * tl.dist(bl); float rSum = areaOf(tl, tr, bl) + areaOf(tr, br, bl); float a1 = areaOf(tl, point, bl); float a2 = areaOf(bl, point, br); float a3 = areaOf(br, point, tr); float a4 = areaOf(point, tr, tl); float pSum = a1 + a2 + a3 + a4; if (pSum - rSum > 2) colliding = false; return colliding; }