fix shift and trace scaling
This commit is contained in:
parent
3e4842dd1a
commit
b8b432234d
1 changed files with 8 additions and 6 deletions
|
@ -529,15 +529,17 @@ void ShiftTraceTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
|
|||
m_oldPos = pos;
|
||||
m_aff[m_ghostIndex] = TTranslation(delta) * m_aff[m_ghostIndex];
|
||||
} else if (m_gadget == ScaleGadget) {
|
||||
TAffine aff = getGhostAff();
|
||||
TPointD c = aff * m_center[m_ghostIndex];
|
||||
TPointD a = m_oldPos - c;
|
||||
TPointD b = pos - c;
|
||||
TAffine aff = getGhostAff();
|
||||
TPointD c = m_center[m_ghostIndex];
|
||||
TPointD a = aff.inv() * m_oldPos - c;
|
||||
TPointD b = aff.inv() * pos - c;
|
||||
TPointD imgC = aff * m_center[m_ghostIndex];
|
||||
|
||||
if (e.isShiftPressed())
|
||||
m_aff[m_ghostIndex] = m_oldAff * TScale(b.x / a.x, b.y / a.y);
|
||||
m_aff[m_ghostIndex] = TScale(imgC, b.x / a.x, b.y / a.y) * m_oldAff;
|
||||
else {
|
||||
double scale = std::max(b.x / a.x, b.y / a.y);
|
||||
m_aff[m_ghostIndex] = m_oldAff * TScale(scale, scale);
|
||||
m_aff[m_ghostIndex] = TScale(imgC, scale) * m_oldAff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue