Commit b5520d41 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

When resizing a geometry effect, like transform, keep item centered

parent 4652d902
Pipeline #22037 passed with stage
in 22 minutes and 56 seconds
...@@ -241,14 +241,18 @@ void GeometryWidget::slotFitToHeight() ...@@ -241,14 +241,18 @@ void GeometryWidget::slotFitToHeight()
} }
void GeometryWidget::slotResize(double value) void GeometryWidget::slotResize(double value)
{ {
m_spinWidth->blockSignals(true); QSignalBlocker bkh(m_spinHeight);
m_spinHeight->blockSignals(true); QSignalBlocker bkw(m_spinWidth);
int w = m_originalSize->isChecked() ? m_sourceSize.width() : m_defaultSize.width(); QSignalBlocker bkx(m_spinX);
int h = m_originalSize->isChecked() ? m_sourceSize.height() : m_defaultSize.height(); QSignalBlocker bky(m_spinY);
m_spinWidth->setValue(w * value / 100.0); int w = (m_originalSize->isChecked() ? m_sourceSize.width() : m_defaultSize.width()) * value / 100.0;
m_spinHeight->setValue(h * value / 100.0); int h = (m_originalSize->isChecked() ? m_sourceSize.height() : m_defaultSize.height()) * value / 100.0;
m_spinWidth->blockSignals(false); int delta_x = (m_spinWidth->value() - w) / 2;
m_spinHeight->blockSignals(false); int delta_y = (m_spinHeight->value() - h) / 2;
m_spinWidth->setValue(w);
m_spinHeight->setValue(h);
m_spinX->setValue(m_spinX->value() + delta_x);
m_spinY->setValue(m_spinY->value() + delta_y);
slotAdjustRectKeyframeValue(); slotAdjustRectKeyframeValue();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment