diff --git a/src/verbs.cpp b/src/verbs.cpp
index 977c22cf8a1de84bd5b987f6ec152e7226c34172..a7e39e38fda5859f40366990e49081a688a7e716 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
#include "sp-flowtext.h"
#include "layer-fns.h"
#include "node-context.h"
+#include "select-context.h"
+#include "seltrans.h"
#include "gradient-context.h"
#include "shape-editor.h"
if (!bbox) {
return;
}
- NR::Point const center(bbox->midpoint());
+ // If the rotation center of the selection is visible, choose it as reference point
+ // for horizontal and vertical flips. Otherwise, take the center of the bounding box.
+ NR::Point center;
+ if (tools_isactive(dt, TOOLS_SELECT) && sel->center() && SP_SELECT_CONTEXT(ec)->_seltrans->centerIsVisible())
+ center = *sel->center();
+ else
+ center = bbox->midpoint();
switch (reinterpret_cast<std::size_t>(data)) {
case SP_VERB_OBJECT_ROTATE_90_CW:
flowtext_to_text();
break;
case SP_VERB_OBJECT_FLIP_HORIZONTAL:
+ // When working with the node tool ...
if (tools_isactive(dt, TOOLS_NODES)) {
- SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::X);
+ Inkscape::NodePath::Node *active_node = Inkscape::NodePath::Path::active_node;
+
+ // ... and one of the nodes is currently mouseovered ...
+ if (active_node) {
+
+ // ... flip the selected nodes about that node
+ SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::X, active_node->pos);
+ } else {
+
+ // ... or else about the center of their bounding box.
+ SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::X);
+ }
+
+ // When working with the selector tool, flip the selection about its rotation center
+ // (if it is visible) or about the center of the bounding box.
} else {
sp_selection_scale_relative(sel, center, NR::scale(-1.0, 1.0));
}
_("Flip horizontally"));
break;
case SP_VERB_OBJECT_FLIP_VERTICAL:
+ // The behaviour is analogous to flipping horizontally
if (tools_isactive(dt, TOOLS_NODES)) {
- SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::Y);
+ Inkscape::NodePath::Node *active_node = Inkscape::NodePath::Path::active_node;
+ if (active_node) {
+ SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::Y, active_node->pos);
+ } else {
+ SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::Y);
+ }
} else {
sp_selection_scale_relative(sel, center, NR::scale(1.0, -1.0));
}