diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp --- a/scribus/scribusdoc.cpp +++ b/scribus/scribusdoc.cpp @@ -14238,33 +14238,94 @@ { QString unitSuffix = unitGetStrFromIndex(this->unitIndex()); int unitPrecision = unitGetPrecisionFromIndex(this->unitIndex()); - QString owString = QString::number(currItem->oldWidth * m_docUnitRatio, 'f', unitPrecision) + " " + unitSuffix; - QString ohString = QString::number(currItem->oldHeight * m_docUnitRatio, 'f', unitPrecision) + " " + unitSuffix; - QString nwString = QString::number(newX * m_docUnitRatio, 'f', unitPrecision) + " " + unitSuffix; - QString nhString = QString::number(newY * m_docUnitRatio, 'f', unitPrecision) + " " + unitSuffix; + QString owString = QString::number(currItem->oldWidth * m_docUnitRatio, 'f', unitPrecision) + " " + unitSuffix; + QString ohString = QString::number(currItem->oldHeight * m_docUnitRatio, 'f', unitPrecision) + " " + unitSuffix; + QString nwString = QString::number(newX * m_docUnitRatio, 'f', unitPrecision) + " " + unitSuffix; + QString nhString = QString::number(newY * m_docUnitRatio, 'f', unitPrecision) + " " + unitSuffix; QString transacDesc = QString(Um::ResizeFromTo).arg(owString).arg(ohString).arg(nwString).arg(nhString); activeTransaction = m_undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), Um::Resize, transacDesc, Um::IResize); } int ph = static_cast(qMax(1.0, currItem->lineWidth() / 2.0)); + + //Check if Width (otherwise Height) is being changed + bool resizeWidth = false; + if (currItem->width() != newX) + resizeWidth = true; + + //Check if Width/Height ratio is fixed + bool resizeLock = false; + if ((currItem->width() == newX) && (currItem->height() == newY)) + resizeLock = true; + QTransform ma; - ma.rotate(currItem->rotation()); + ma.rotate(360.0 - currItem->rotation()); double dX = ma.m11() * (currItem->width() - newX) + ma.m21() * (currItem->height() - newY) + ma.dx(); double dY = ma.m22() * (currItem->height() - newY) + ma.m12() * (currItem->width() - newX) + ma.dy(); -// #8541, #8761: "when resizing with ALT-arrow, the size values in the PP aren't updated" -// currItem->setWidthHeight(newX, newY, true); + //#8541, #8761: "when resizing with ALT-arrow, the size values in the PP aren't updated" + //currItem->setWidthHeight(newX, newY, true); currItem->setWidthHeight(newX, newY); + /*#3612: + *Changing Width or Height of an item should be consistent with active basepoint. + *Summary of rotation modes and relative basepoints: + *rotMode == 0 is top left (OK) Lock (OK) + *rotMode == 1 is top right (OK) Lock (TODO) + *rotMode == 2 is center (OK) Lock (TODO) + *rotMode == 3 is bottom left (OK) Lock (TODO) + *rotMode == 4 is bottom right (OK) Lock (TODO) + */ if ((m_rotMode != 0) && (fromMP) && (!isLoading()) && (appMode == modeNormal)) { - double moveX=dX, moveY=dY; - if (m_rotMode==2) + double moveX = dX, moveY = dY; + if (m_rotMode == 1) { - moveX/=2.0; - moveY/=2.0; + if (resizeWidth) + moveY *= -1.0; + else if (resizeLock) + { + //TODO + } + else + moveX = moveY = 0.0; } - else if (m_rotMode==3) - moveX=0.0; - else if (m_rotMode==1) - moveY=0.0; + else if (m_rotMode == 2) + { + if (resizeWidth) + { + moveX /= 2.0; + moveY /= -2.0; + } + else if (resizeLock) + { + //TODO + } + else + { + moveX /= -2.0; + moveY /= 2.0; + } + } + else if (m_rotMode == 3) + { + if (resizeWidth) + moveX = moveY = 0.0; + else if (resizeLock) + { + //TODO + } + else + moveX *= -1.0; + } + else if (m_rotMode == 4) + { + if (resizeWidth) + moveY *= -1.0; + else if (resizeLock) + { + //TODO + } + else + moveX *= -1.0; + } moveItem(moveX, moveY, currItem); } if ((currItem->asImageFrame()) && (!currItem->Sizing) && (appMode != modeEditClip))