Disable selection handles when a key modifier is pressed

From: https://twitter.com/ChevyRay/status/893563998410387457
This commit is contained in:
David Capello 2017-09-08 12:07:21 -03:00
parent 7b7b12b593
commit 2d51b8dfff
6 changed files with 24 additions and 3 deletions

View File

@ -193,6 +193,7 @@
<section id="selection">
<option id="mode" type="SelectionMode" default="SelectionMode::DEFAULT" />
<option id="move_edges" type="bool" default="true" />
<option id="modifiers_disable_handles" type="bool" default="true" />
<option id="pivot_visibility" type="bool" default="false" />
<option id="pivot_position" type="PivotPosition" default="PivotPosition::CENTER" />
<option id="opaque" type="bool" default="false" />

View File

@ -328,6 +328,12 @@ Check this if you want to be able to drag
only the selection edges when the mouse is
above them.
END
modifiers_disable_handles = Disable transformation handles when key modifiers are pressed
modifiers_disable_handles_tooltip = <<<END
If you press Shift/Ctrl/Alt keys, the handles
to transform the selection will be temporarily
disabled.
END
autotimeline = Show timeline automatically
autotimeline_tooltip = <<<END
Show the timeline automatically

View File

@ -96,6 +96,7 @@
<check text="@.auto_opaque" id="auto_opaque" tooltip="@.auto_opaque_tooltip" />
<check text="@.keep_selection_after_clear" id="keep_selection_after_clear" tooltip="@.keep_selection_after_clear_tooltip" />
<check text="@.move_edges" id="move_edges" tooltip="@.move_edges_tooltip" />
<check text="@.modifiers_disable_handles" id="modifiers_disable_handles" tooltip="@.modifiers_disable_handles_tooltip" />
</vbox>
<!-- Timeline -->

View File

@ -198,6 +198,9 @@ public:
if (m_pref.selection.moveEdges())
moveEdges()->setSelected(true);
if (m_pref.selection.modifiersDisableHandles())
modifiersDisableHandles()->setSelected(true);
// If the platform supports native cursors...
if ((int(she::instance()->capabilities()) &
int(she::Capabilities::CustomNativeMouseCursor)) != 0) {
@ -382,6 +385,7 @@ public:
m_pref.selection.autoOpaque(autoOpaque()->isSelected());
m_pref.selection.keepSelectionAfterClear(keepSelectionAfterClear()->isSelected());
m_pref.selection.moveEdges(moveEdges()->isSelected());
m_pref.selection.modifiersDisableHandles(modifiersDisableHandles()->isSelected());
m_pref.guides.layerEdgesColor(layerEdgesColor()->getColor());
m_pref.guides.autoGuidesColor(autoGuidesColor()->getColor());
m_pref.slices.defaultColor(defaultSliceColor()->getColor());

View File

@ -254,7 +254,9 @@ bool MovingPixelsState::onMouseDown(Editor* editor, MouseMessage* msg)
// Transform selected pixels
if (document->isMaskVisible() &&
decorator->getTransformHandles(editor)) {
decorator->getTransformHandles(editor) &&
(!Preferences::instance().selection.modifiersDisableHandles() ||
msg->modifiers() == kKeyNoneModifier)) {
TransformHandles* transfHandles = decorator->getTransformHandles(editor);
// Get the handle covered by the mouse.

View File

@ -56,6 +56,7 @@
#include "fixmath/fixmath.h"
#include "gfx/rect.h"
#include "she/surface.h"
#include "she/system.h"
#include "ui/alert.h"
#include "ui/message.h"
#include "ui/system.h"
@ -248,7 +249,9 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
// Transform selected pixels
if (editor->isActive() &&
document->isMaskVisible() &&
m_decorator->getTransformHandles(editor)) {
m_decorator->getTransformHandles(editor) &&
(!Preferences::instance().selection.modifiersDisableHandles() ||
msg->modifiers() == kKeyNoneModifier)) {
TransformHandles* transfHandles = m_decorator->getTransformHandles(editor);
// Get the handle covered by the mouse.
@ -807,7 +810,11 @@ bool StandbyState::Decorator::onSetCursor(tools::Ink* ink, Editor* editor, const
if (!editor->isActive())
return false;
if (ink && ink->isSelection() && editor->document()->isMaskVisible()) {
if (ink &&
ink->isSelection() &&
editor->document()->isMaskVisible() &&
(!Preferences::instance().selection.modifiersDisableHandles() ||
she::instance()->keyModifiers() == kKeyNoneModifier)) {
auto theme = skin::SkinTheme::instance();
const Transformation transformation(m_standbyState->getTransformation(editor));
TransformHandles* tr = getTransformHandles(editor);