arrow marker end to coincide with path end

Bug #170542 reported by Bug Importer
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Wishlist
Unassigned

Bug Description

when I want to put a distance beetween two object I use
a line in between.
The problem is that the head of the arrow is not center
on the control point of the path.

like this
<x----------x->

I would like this

 x<-------->x

Have a nice day

Tags: markers styles
Revision history for this message
Vanzandt (vanzandt) wrote :

I second this request: I would prefer that an end marker not
extend beyond the control point.

Revision history for this message
Vanzandt (vanzandt) wrote :

...at least for beginning and ending arrow heads. Some of
the symbols (dot, square, diamond) only make sense centered
on the control point.

Revision history for this message
Norbert Nemec (nnemec) wrote :

I agree. Using arrow heads really is a mess at the
moment. In addition to the above request, I would
suggest reworking the behavior of arrow heads when a
object is scaled. Currently, the arrow is distorted while
dragging and then jumps to another shape when the
mouse button is released.

Revision history for this message
Prokoudine (prokoudine) wrote :

Seconded

Revision history for this message
Bug Importer (bug-importer) wrote :

And the arrow should have the same color as the
filled/coloured path (even though this seems not to be clean
svg). At least the arrow's colour should be editable.

Revision history for this message
Bryce Harrington (bryce) wrote :

The color issue already has a bug: 995815

It's easy to make the marker's edge coincide with the
control point, however the line's end cap shows through. So
there needs to be a way to suppress the end cap rendering
when a marker is on it. I had no idea how to do that so
implemented it as it works currently so that at least it
*looks* correct. However, I agree it is cumbersome to use.

If anyone wishes to fix it, send me a patch. Otherwise,
I'll investigate it myself when I have time.

Revision history for this message
nightrow (jb-benoit) wrote :

This is still an issue on the current 0.45.1 version.
Please close it as won't fix if this is the wanted behavior.

Changed in inkscape:
importance: Medium → Wishlist
status: New → Confirmed
Bryce Harrington (bryce)
Changed in inkscape:
assignee: Bryce Harrington (bryceharrington) → nobody
jazzynico (jazzynico)
tags: added: markers
removed: other
Revision history for this message
M8R-98booy (m8r-98booy-mailinator) wrote :

I really would like to have this feature as it is important to make good loking technical drawings for reports, etc.

Revision history for this message
Eli Osherovich (eli-osherovich) wrote :

Still an issue in 0.48 (more than 6 years after the original bug report).

Revision history for this message
Tom Browder (tbrowder) wrote :

Still an issue on 2013-05-19 with latest version, 0.48.4.

Revision history for this message
Bart Van Audenhove (bart-vanaudenhove) wrote :

Seconded, and still an issue in 0.91.

Revision history for this message
CahootsMalone (cahootsmalone) wrote :
Download full text (3.2 KiB)

I'd also like to see Inkscape provide functionality to ensure the tip of an arrow marker coincides with the path vertex it's associated with. However, as noted in various locations (see links below), due to the nature of the SVG specification, it's not possible to do this without the path being visible underneath the marker. For example, try adjusting the refX attribute of the marker in this SVG code (an example from the W3C SVG specification) and viewing the result:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="4in" height="2in"
     viewBox="0 0 4000 2000" version="1.1"
     xmlns="http://www.w3.org/2000/svg">
  <defs>
    <!-- Try different values in refX (0 to 10). -->
    <!-- Note that, for refX = 10, the point of the arrowhead coincides with the path vertex, but the path is visible underneath. -->
    <marker id="Triangle"
      viewBox="0 0 10 10" refX="SET THIS TO A NUMBER BETWEEN 0 AND 10" refY="5"
      markerUnits="strokeWidth"
      markerWidth="4" markerHeight="3"
      orient="auto">
      <path d="M 0 0 L 10 5 L 0 10 z" />
    </marker>
  </defs>
  <rect x="10" y="10" width="3980" height="1980"
       fill="none" stroke="blue" stroke-width="10" />
  <path d="M 1000 750 L 2000 750 L 2500 1250"
        fill="none" stroke="black" stroke-width="100"
        marker-end="url(#Triangle)" />
</svg>

If refX is set to 10, the tip of the arrowhead coincides with the path vertex, but the path can be seen underneath the marker where the width of the path exceeds that of the arrow.

Until the SVG specification is updated to account for this (which may never happen), perhaps functionality could be added to Inkscape to allow the tip of an arrow marker to be used as a snapping point. Alternatively, Inkscape could place the marker such that its tip coincides with where the path vertex would be with no marker, but reduce the actual length of the path by the width of a selected marker for markers flagged as arrowheads, hiding this change under the hood and still displaying an "apparent" path vertex at the tip of the arrow marker (in the same location the real path vertex would be placed if no marker were selected).

I haven't looked at the Inkscape codebase, so these are uninformed suggestions in the sense that I have no idea how difficult they would be the implement in the context of the existing code; just some ideas!

Regardless, it would be very nice to see Inkscape provide some workaround to allow precise positioning of arrow tips, at least until the SVG specification is updated to address this deficiency.

Online discussion of SVG limitations regarding markers:

http://www.inkscapeforum.com/viewtopic.php?t=11932#p48774 (this post from 2012 mentions that someone from the SVG working group was looking into this; evidently nothing came of this)

http://stackoverflow.com/questions/31278293/svg-align-tip-of-marker-end-with-end-of-line (this answer to this question does align the marker tip to the end of the line, but the line will be visible underneath as mentioned above)

http://stackoverflow.com/questions/24481536/svg-inverse-marker-m...

Read more...

Revision history for this message
Patrick Storz (ede123) wrote :

I've got a "crazy" idea on how we might work around this even with the limitations of the SVG specification:
By clever use of the "stroke-dasharray" property we could "shorten" the path at the beginning and/or end (depending on where we want to put markers), achieving a control point which can line up with the tip of the marker without the path end protruding.

The attachment shows an example of what I have in mind:
- The shown path is exactly 440 px long,
  the start/end nodes are aligned on the blue lines
- When aligning the markers accordingly the path is
  clearly visible which is undesirable
- Setting stroke-dasharray="0,20,400,20,0" now results
  in the rendered path effectively becoming shorter by
  20 px on each side resulting in a path lenght of only
  400 px; the start/end nodes are still aligned with the
  blue lines, though, their coordinates did not change
- Putting the same markers on the path now achieves
  the desired result!

An actual implementation should probably calculate the length of the path on-the-fly and - taking into account the length of the start/end markers - set the stroke-dasharray accordingly.

What are your opinions? Is this a viable method? Are there any issues I did not think about? Let me know what you think!

Revision history for this message
Jonathan Hofinger (jhofinger) wrote :

Hi - thanks for reporting this bug, I've manually migrated it to Inkscape's new bug tracker on GitLab, and closed it here.

Please feel free to file new bugs about the issues you're seeing at http://inkscape.org/report.

Moved to: https://gitlab.com/inkscape/inbox/issues/1980
Closed by: https://gitlab.com/jhofinger

Changed in inkscape:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.