Bug 92152 - Add half arrowheads
Summary: Add half arrowheads
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
4.3.6.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0
Keywords: easyHack, needsUXEval, skillDesign, topicUI
Depends on:
Blocks: Connectors
  Show dependency treegraph
 
Reported: 2015-06-18 12:19 UTC by Robert Pollak
Modified: 2017-02-14 08:58 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Example (found at http://www.cavalrypilot.com/fm21-26/Ch6.htm) (829 bytes, image/png)
2015-06-18 12:19 UTC, Robert Pollak
Details
Leif's half arrow in 0.2, 1, and 5cm size (1.48 KB, application/pdf)
2016-06-20 23:02 UTC, Heiko Tietze
Details
Screenshot, how Karbon shows this arrow heads (27.88 KB, image/png)
2016-09-12 11:04 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Pollak 2015-06-18 12:19:42 UTC
Created attachment 116621 [details]
Example (found at http://www.cavalrypilot.com/fm21-26/Ch6.htm)

I would need arrows with half arrowheads, like the arrow in the attached image.
Comment 1 raal 2015-06-18 18:35:01 UTC
Setting as enhancement
Comment 2 Heiko Tietze 2016-06-14 14:54:41 UTC
Link is dead, here is another example: http://tex.stackexchange.com/questions/195623/drawing-a-half-arrow-with-tikz

We would need it above and below. Is this an EASYHACK?
Comment 3 Regina Henschel 2016-06-14 18:07:57 UTC
Yes it is easy. In a first step a volunteer can design such arrow head. There exists the files standard.soe and arrowhd.soe in the installed LibreOffice in share > palette. There you can add a new line end. It will be available in your installation and you can test it. And then attach the changed file to this issue for discussion.

In a second step UX can decide whether such arrow is useful for all users and important enough to make it always available, then it can be added to official standard.soe; or if only important for few but advanced users, then to arrowhd.soe. Of cause then with a proper patch in Gerrit.

Needed skills (besides compiling and use of Gerrit): Know how to write a SVG path manually. The two files can work as example how such arrow heads are defined.
Comment 4 Buovjaga 2016-06-17 16:47:09 UTC
Regina: are you willing to mentor this one? Or shall we remove easyHack keyword until a mentor appears?
Comment 5 Regina Henschel 2016-06-17 17:19:23 UTC
I'm willing to mentor it.
Comment 6 Heiko Tietze 2016-06-17 19:26:25 UTC
Let's keep it under needsUXeval until finished. Its a design only work and the ux people should take an eye onto. Mentoring means primarily to commit.
Comment 7 Leif Lodahl 2016-06-20 18:00:36 UTC
Suggestion:

<draw:marker draw:name="Half filled arrow" svg:viewBox="0 0 2101 1801" svg:d="M1101 0l-1101 1800h1101zM1101 0zM0 1801zM1101 0l1000 1800z"/>
Comment 8 Regina Henschel 2016-06-20 22:18:30 UTC
I have searched a little bit. "half arrowhead" is used:

(mostly drawn filled)
single electron movement
"magnetic north" symbol

(mostly drawn as line)
chemical equilibrium
UML asynchronous message

Search for black/white images and the above phrases give some useful results.

Connecting head and line should work best for a ratio of line width 0.02cm to arrow head width 0.3cm. That is the ratio assumed in the code. Your proposal seems a little bit off in that ratio.

In your proposal the arrow head is on the left side. Looking at the pictures I have seen, it seems that a version with arrow head on the right side is needed too.

Your path has two zero movements. Why?

pdf-export has an additional line on the right side. I do not know why. It might be an error in the pdf export.
Comment 9 Heiko Tietze 2016-06-20 23:02:42 UTC
Created attachment 125785 [details]
Leif's half arrow in 0.2, 1, and 5cm size

Nice work, Leif!

(In reply to Regina Henschel from comment #8)
> In your proposal the arrow head is on the left side. Looking at the pictures
> I have seen, it seems that a version with arrow head on the right side is
> needed too.

Or above vs. below the line in respect to start or end point. This version is above on the right/end side and below at left/start. Additionally, it looks like an imperfect placement, esp. when zoomed or at large size. 

Attaching a PDF for the lazy.
Comment 10 Heiko Tietze 2016-06-21 07:52:57 UTC
Requested in bug 93782 are inverted arrows and antenna symbol/bird leg like arrowheads. Would be good if we can close both tickets at once.
Comment 11 Raj Sarkar 2016-07-15 21:30:04 UTC
Any idea on how the alignment problem can be solved? Currently the arrow head is offset by a distance half the width of its parent line. I think we would have to do this using code and not just svg/xml, since the width of the line on which the arrow heads will be placed will only be available at run time.
Comment 12 Yan Pas 2016-08-07 13:51:57 UTC
I've done this quest too: 
  <draw:marker draw:name="Half Arrow" svg:viewBox="0 0 10 10" svg:d="M0 0 m-10 0 h-10 l10 -30 v30" />

you can test it via http://www.w3schools.com/svg/tryit.asp?filename=trysvg_path
Comment 13 Heiko Tietze 2016-08-08 07:31:41 UTC
(In reply to Yan Pas from comment #12)
> I've done this quest too: 
>   <draw:marker draw:name="Half Arrow" svg:viewBox="0 0 10 10" svg:d="M0 0
> m-10 0 h-10 l10 -30 v30" />
> 
> you can test it via
> http://www.w3schools.com/svg/tryit.asp?filename=trysvg_path

Looks good from my side but we need one half above the line and another below ("Half Arrow Top", "Half Arrow Bottom").
Comment 14 abhilash300singh 2016-08-30 18:19:02 UTC
(In reply to Yan Pas from comment #12)
> I've done this quest too: 
>   <draw:marker draw:name="Half Arrow" svg:viewBox="0 0 10 10" svg:d="M0 0
> m-10 0 h-10 l10 -30 v30" />
> 
> you can test it via
> http://www.w3schools.com/svg/tryit.asp?filename=trysvg_path

I can't see how it will turn into a half arrow head. Wouldn't that render as full arrow head.
Comment 15 Regina Henschel 2016-09-12 11:04:22 UTC
Created attachment 127272 [details]
Screenshot, how Karbon shows this arrow heads

The proposal in https://gerrit.libreoffice.org/#/c/28603/1 has problems.

Some coordinates in svg:d are outside the range given by svg:viewbox. LibreOffice can handle this, but other applications not. We should avoid it for interoperability, as there is no reason for describing the path in this way. The attachment is a screenshot from Karbon (Calligra Suite).

The path has two Move commands at the beginning. That makes no sense. It will produce an additional irregular point, when you produce a meta file and break it up.
Comment 16 Regina Henschel 2016-09-12 11:30:50 UTC
An arrow head is defined independent of the line to which it will be attached and the definition of the arrow head has no means to reference the prospective line width. The only way to have some influence on the arrow head is by its width. Therefore a left arrow cannot align with the right edge of the line stroke in all cases.

The proposed arrow will always align with the middle of the line stroke, which produces a corner with thick lines. Unfortunately I see no way to workaround this problem. If you shift the arrow a little bit to the right, that will only fit for a special line-width/arrow-head-width combination. It is a question, whether we should produce such solution "fit best for line-width 0.02cm" (0.02cm only as example). Currently it is a "fit best for hairline" solution.
Comment 17 Commit Notification 2016-10-06 09:30:57 UTC
Heiko Tietze committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b15fef02c9311e0c160906769abbf96a96e56c73

tdf#93782 Reversed line endings and tdf#92152 half-arrow heads

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Heiko Tietze 2016-10-06 09:31:57 UTC
Solved as part of 93782 at https://gerrit.libreoffice.org/#/c/29555/