bool MgBaseRect::_setHandlePoint(UInt32 index, const Point2d& pt, float) { Point2d pt2(pt * Matrix2d::rotation(-getAngle(), getCenter())); Box2d rect(getRect()); mgMoveRectHandle(rect, index, pt2); setRect(rect, getAngle()); update(); return true; }
bool MgBaseRect::_setHandlePoint(UInt32 index, const Point2d& pt, float) { if (index < 4 && getFlag(kMgSquare)) { Point2d basept(getCenter()); Point2d pt2(pt * Matrix2d::rotation(-getAngle(), basept)); setRect(basept * 2.f - pt2.asVector(), pt2, getAngle(), basept); } else { Point2d pt2(pt * Matrix2d::rotation(-getAngle(), getCenter())); Box2d rect(getRect()); mgMoveRectHandle(rect, index, pt2); if (getFlag(kMgSquare) && (4 == index || 6 == index)) { rect = Box2d(rect.center(), rect.height(), rect.height()); } else if (getFlag(kMgSquare)) { rect = Box2d(rect.center(), rect.width(), rect.width()); } setRect(rect.leftTop(), rect.rightBottom(), getAngle(), getCenter()); } update(); return true; }