Skip to content

Commit

Permalink
fixes issue bbecquet#86: Decorators drawn when offset larger than lin…
Browse files Browse the repository at this point in the history
…e length
  • Loading branch information
plepe committed Nov 12, 2018
1 parent 96858e8 commit 742dbe2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions dist/leaflet.polylineDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ function projectPatternOnPointPath(pts, pattern) {
// 2. generate the positions of the pattern as offsets from the path start
var positionOffsets = [];
var positionOffset = startOffsetPixels;
do {
while (repeatIntervalPixels > 0 && positionOffset < totalPathLength - endOffsetPixels) {
positionOffsets.push(positionOffset);
positionOffset += repeatIntervalPixels;
} while (repeatIntervalPixels > 0 && positionOffset < totalPathLength - endOffsetPixels);
}

// 3. projects offsets to segments
var segmentIndex = 0;
Expand Down Expand Up @@ -182,6 +182,12 @@ function interpolateBetweenPoints(ptA, ptB, ratio) {
});
})();

// enable rotationAngle and rotationOrigin support on L.Marker
/**
* Defines several classes of symbol factories,
* to be used with L.PolylineDecorator
*/

L$1.Symbol = L$1.Symbol || {};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/patternUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ function projectPatternOnPointPath(pts, pattern) {
// 2. generate the positions of the pattern as offsets from the path start
const positionOffsets = [];
let positionOffset = startOffsetPixels;
do {
while(repeatIntervalPixels > 0 && positionOffset < totalPathLength - endOffsetPixels) {
positionOffsets.push(positionOffset);
positionOffset += repeatIntervalPixels;
} while(repeatIntervalPixels > 0 && positionOffset < totalPathLength - endOffsetPixels);
}

// 3. projects offsets to segments
let segmentIndex = 0;
Expand Down

0 comments on commit 742dbe2

Please sign in to comment.