Change locked horizon movement to Shift+Alt

This commit is contained in:
manongjohn 2021-11-18 17:33:37 -05:00
parent 0b689db2dd
commit d3120e6dec
2 changed files with 23 additions and 25 deletions

View file

@ -1194,13 +1194,11 @@ void PerspectiveTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
TPointD rotationPos = obj->getRotationPos();
TPointD spacingPos = obj->getSpacingPos();
if (m_isShifting)
obj->shiftPerspectiveObject(dPos);
else if (m_isCenterMoving) { // Moving
if (m_isShifting) {
if (obj->isHorizon() && e.isAltPressed()) {
double distance =
std::sqrt(std::pow(dPos.x, 2) + std::pow(dPos.y, 2));
double rotation = mainObj->getRotation();
double rotation = obj->getRotation();
if (rotation != 90 && rotation != 270) {
if (dPos.x < 0) distance *= -1;
if (rotation > 90 && rotation < 270) distance *= -1;
@ -1212,28 +1210,24 @@ void PerspectiveTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
dPos = newCenter - objCenterPoint;
}
obj->shiftPerspectiveObject(dPos);
} else if (m_isCenterMoving) { // Moving
TPointD newCenterPoint = objCenterPoint + dPos;
obj->setCenterPoint(newCenterPoint);
if (obj->isHorizon() && e.isAltPressed()) {
// Move Rotation/Space controls to maintain angle/spacing
obj->setRotationPos(rotationPos + dPos);
obj->setSpacingPos(spacingPos + dPos);
} else {
// Recalculate Angle
double dx = rotationPos.x - newCenterPoint.x;
double dy = rotationPos.y - newCenterPoint.y;
double newAngle = std::atan2(dy, dx) / (3.14159 / 180);
if (obj->getType() == PerspectiveType::VanishingPoint) newAngle += 90;
obj->setRotation(newAngle);
// Recalculate Angle
double dx = rotationPos.x - newCenterPoint.x;
double dy = rotationPos.y - newCenterPoint.y;
double newAngle = std::atan2(dy, dx) / (3.14159 / 180);
if (obj->getType() == PerspectiveType::VanishingPoint) newAngle += 90;
obj->setRotation(newAngle);
// Recalculate Spacing
double newSpacing =
calculateSpacing(obj->getType(), spacingPos, rotationPos,
obj->getRotation(), objCenterPoint);
obj->setSpacing(newSpacing);
if (obj == mainObj) updateMeasuredValueToolOptions();
}
// Recalculate Spacing
double newSpacing =
calculateSpacing(obj->getType(), spacingPos, rotationPos,
obj->getRotation(), objCenterPoint);
obj->setSpacing(newSpacing);
if (obj == mainObj) updateMeasuredValueToolOptions();
// Also Move Left and Right Handles
if (obj->getType() == PerspectiveType::VanishingPoint) {

View file

@ -346,16 +346,20 @@ std::unordered_map<std::string, QString> StatusBar::makeMap(
lMap.insert({"T_Ruler", tr("Ruler Tool: Measures distances on the canvas")});
lMap.insert({"T_PerspectiveGrid",
tr("Perspective Grid Tool: Set up perspective grids") + spacer +
tr("%1%2Move Perspective Objects")
tr("%1%2Move entire object")
.arg(trModKey("Shift"))
.arg(cmdTextSeparator) +
spacer +
tr("%1%2Select/Deselect multiple; +A to Select All")
tr("%1%2Select/Deselect multiple")
.arg(trModKey("Ctrl"))
.arg(cmdTextSeparator) +
spacer +
tr("%1%2Snap rotation/space; Move center along horizon")
tr("%1%2Snap rotation/spacing")
.arg(trModKey("Alt"))
.arg(cmdTextSeparator) +
spacer +
tr("%1%2Move object along horizon")
.arg(trModKey("Shift+Alt"))
.arg(cmdTextSeparator)});
lMap.insert(
{"T_Finger", tr("Finger Tool: Smudges small areas to cover with line")});