Comments (6)
The icons are fixed size and the arrowhead just touches the icon no matter what length the arrow polyline is. Thanks!
from leaflet.polylinedecorator.
Apologies, but this prompted a simple question. I have been told that it is not possible to draw a simple arrow ... line with an arrowhead at the end ... with PolylineDecorator. Could you clarify if it is possible to draw a simple arrow? Thanks.
I assumed endOffset = 0 and no offset parameter, but I am told that doesn't work.
from leaflet.polylinedecorator.
Hi @EllanVhow.
Yes you can, but you have to use a 100% offset
instead of using endOffset
. Like this:
var arrow = L.polyline([[57, -19], [60, -12]]).addTo(map);
var arrowHead = L.polylineDecorator(arrow, {
patterns: [
{
offset: '100%',
repeat: 0,
symbol: L.Symbol.arrowHead({pixelSize: 15, polygon: false, pathOptions: {stroke: true}})
}
]
}).addTo(map);
endOffset
has been introduced quite late in the project, now I understand it may be counter-intuitive that it doesn't behave like you thought.
(BTW, sorry @cladocora for never having answered your question in the first place :/)
from leaflet.polylinedecorator.
Yes. Thank you. I should have clarified that we were trying to use the fixed pixel offset. The problem is that we need to hold the arrowhead back from the destination icon so that it is not covered by the icon. When we try to choose a percentage to hold the arrowhead back, it is just right for short segments and then is held way back from the destination in the long segments. It is not consistently "at the end" of the line. We could calculate a shorter polyline and hold back the actual end point, but again, we have to figure out that hold back in pixels somehow rather than in geo-coordinates.
If we had two decorations .. perhaps a dot for the start and an arrowhead for the end, would the endOffset in pixels work? ... be applied to the arrowhead?
Thank you!
from leaflet.polylinedecorator.
Alternatively, could we 'draw' the polyline from End to Start and then put a Reverse Arrowhead at a pixel offset from the start of the line (which is actually our End point)?
from leaflet.polylinedecorator.
The latter worked. Reversed the start and end in the point list, then set headAngle to -290 in L.Symbol.ArrowHead and adjusted the offset for the pixel size of the arrowhead.
from leaflet.polylinedecorator.
Related Issues (20)
- How in leaflet add custom data to polyline?
- I'd like to ask you how to add slashes to polygons, like this
- how do i delete some arrow on the map HOT 1
- Separate colors for stroke, fill HOT 1
- Markers Color HOT 9
- Leaflet polyline decorator HOT 1
- Decorator onclick event retrieve property HOT 1
- How to disable arrow auto scale? HOT 2
- Using polylineDecorator with ant-path is not working HOT 1
- Show/Hide Polylinedecorators dynamically (based on other variable) in React Leaflet
- Is there any option to prevent collision between arrows?
- How to add multiple arrows in one line๏ผ HOT 2
- How do I make my arrowhead pointy? HOT 2
- Issue with Leaflet.PolylineOffset
- rotationAngle conflicts with Leaflet.RotatedMarker HOT 4
- L.polylineDecorator is Undefined HOT 2
- PolylineDecorator always top layer even when calling bringToBack() HOT 3
- Polyline decorator doesn't preserve the state of symbol styling HOT 1
- Problem with fullscreen control
- Problem with using method setPaths
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.polylinedecorator.