[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: [krita/kazakov/svg-loading] plugins/tools/defaulttool/defaulttool: Add more feedback on disabling "U
From: Dmitry Kazakov <null () kde ! org>
Date: 2016-12-30 10:02:46
Message-ID: E1cMu1O-00089h-9D () code ! kde ! org
[Download RAW message or body]
Git commit b128126189b5b8f86902ec23311a9efb14f5c230 by Dmitry Kazakov.
Committed on 30/12/2016 at 09:51.
Pushed by dkazakov into branch 'kazakov/svg-loading'.
Add more feedback on disabling "Uniform Scaling" mode
Uniform Scaling mode means that your shape is not just "resized", but
"transformed" using a uniform transformation.
When you "resize" (uniform scaling disabled) a shape, you basically
change its local width and height (even when the shape is rotated
using some embedded transformation). Resizing can never shear or deform
your shape, that is a resized rectangle will always stay rectangular.
When you "uniform scale" a shape, you don't "resize" it, you apply a
transformation to it. That is all the small elements of the shape like
stroke, pattern and gradient will also become scaled. And if you apply
a uniform scale transform in global mode to a rotated shape, then
the shape will be scaled uniformly, and rectangle will become sheared.
NOTE1: Non-uniform scaling mode is available only when
*one* shape is selected. "Resizing" multiple shapes
in a non-uniform way is just not possible. Therefore the
checkbox becomes automatically disabled when you select
multiple shapes.
NOTE2: Groups do not support non-uniform "resizing" (see NOTE1).
Technically, resizing of a group is just applying a common
transformation on the top of the child shapes. Therefore, all
the properties of the uniform scaling apply to this process.
CC:kimageshop@kde.org
M +11 -2 plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp
M +1 -0 plugins/tools/defaulttool/defaulttool/DefaultToolWidget.h
https://commits.kde.org/krita/b128126189b5b8f86902ec23311a9efb14f5c230
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp \
b/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp index \
668e9ce562d..cee5c36805a 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp
+++ b/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.cpp
@@ -57,6 +57,7 @@ DefaultToolWidget::DefaultToolWidget(KoInteractionTool *tool, \
QWidget *parent) : QWidget(parent)
, m_tool(tool)
, m_sizeAspectLocker(new KisAspectRatioLocker())
+ , m_savedUniformScaling(false)
{
setupUi(this);
@@ -190,11 +191,19 @@ void DefaultToolWidget::slotUpdateCheckboxes()
KoSelection *selection = m_tool->canvas()->shapeManager()->selection();
QList<KoShape*> shapes = fetchEditableShapes(selection);
- chkUniformScaling->setEnabled(shapes.size() == 1);
+ const bool uniformScalingAvailable = shapes.size() <= 1;
+
+ if (uniformScalingAvailable && !chkUniformScaling->isEnabled()) {
+ chkUniformScaling->setChecked(m_savedUniformScaling);
+ chkUniformScaling->setEnabled(uniformScalingAvailable);
+ } else if (!uniformScalingAvailable && chkUniformScaling->isEnabled()) {
+ m_savedUniformScaling = chkUniformScaling->isChecked();
+ chkUniformScaling->setChecked(true);
+ chkUniformScaling->setEnabled(uniformScalingAvailable);
+ }
// TODO: not implemented yet!
chkAnchorLock->setEnabled(false);
- chkGlobalCoordinates->setEnabled(false);
}
void DefaultToolWidget::slotAspectButtonToggled()
diff --git a/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.h \
b/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.h index \
16d2d2f9397..b2b0845b2a4 100644
--- a/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.h
+++ b/plugins/tools/defaulttool/defaulttool/DefaultToolWidget.h
@@ -58,6 +58,7 @@ private Q_SLOTS:
private:
KoInteractionTool *m_tool;
QScopedPointer<KisAspectRatioLocker> m_sizeAspectLocker;
+ bool m_savedUniformScaling;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic