summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2019-09-13 10:58:56 +0000
committerTavmjong Bah <tavmjong@free.fr>2019-09-13 10:58:56 +0000
commit5c8bc8ce7dbec123214245d13fe07dcac7f727fb (patch)
tree18616fd56acdccfedc6cea8c5ee761145f65cd1c
parentA value of zero for 'inline-size' should act as if 'inline-size' is not set. ... (diff)
downloadinkscape-5c8bc8ce7dbec123214245d13fe07dcac7f727fb.tar.gz
inkscape-5c8bc8ce7dbec123214245d13fe07dcac7f727fb.zip
UX improvement for creating/modifying 'inline-size' text.
-rw-r--r--src/ui/shape-editor-knotholders.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/ui/shape-editor-knotholders.cpp b/src/ui/shape-editor-knotholders.cpp
index a2aa9919a..2f1628154 100644
--- a/src/ui/shape-editor-knotholders.cpp
+++ b/src/ui/shape-editor-knotholders.cpp
@@ -1772,15 +1772,40 @@ TextKnotHolderEntityInlineSize::knot_set(Geom::Point const &p, Geom::Point const
double size = 0.0;
if (mode == SP_CSS_WRITING_MODE_LR_TB ||
mode == SP_CSS_WRITING_MODE_RL_TB) {
- size = abs(delta[Geom::X]);
+ // horizontal
+
+ size = delta[Geom::X];
+ if ( (direction == SP_CSS_DIRECTION_LTR && anchor == SP_CSS_TEXT_ANCHOR_START ) ||
+ (direction == SP_CSS_DIRECTION_RTL && anchor == SP_CSS_TEXT_ANCHOR_END) ) {
+ // Do nothing
+ } else if ( (direction == SP_CSS_DIRECTION_LTR && anchor == SP_CSS_TEXT_ANCHOR_END ) ||
+ (direction == SP_CSS_DIRECTION_RTL && anchor == SP_CSS_TEXT_ANCHOR_START) ) {
+ size = -size;
+ } else if ( anchor == SP_CSS_TEXT_ANCHOR_MIDDLE) {
+ size = 2.0 * abs(size);
+ } else {
+ std::cerr << "TextKnotHolderEntityInlinSize: Should not be reached!" << std::endl;
+ }
+
} else {
+ // vertical
+
size = delta[Geom::Y];
+ if (anchor == SP_CSS_TEXT_ANCHOR_START) {
+ // Do nothing
+ } else if (anchor == SP_CSS_TEXT_ANCHOR_END) {
+ size = -size;
+ } else if (anchor == SP_CSS_TEXT_ANCHOR_MIDDLE) {
+ size = 2.0 * abs(size);
+ }
}
- if (anchor == SP_CSS_TEXT_ANCHOR_MIDDLE) {
- size *= 2.0;
+
+ // Size should never be negative
+ if (size < 0.0) {
+ size = 0.0;
}
- text->style->inline_size.setDouble(abs(size));
+ text->style->inline_size.setDouble(size);
text->style->inline_size.set = true;
text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);