Skip to content

Commit

Permalink
Fix decorators drawn outside the polyline boundaries when zoomed out
Browse files Browse the repository at this point in the history
  • Loading branch information
briquet committed Sep 12, 2019
1 parent 96858e8 commit 4eb191c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leaflet-polylinedecorator",
"version": "1.6.0",
"version": "1.6.1",
"repository": "bbecquet/Leaflet.PolylineDecorator",
"main": "./dist/leaflet.polylineDecorator.js",
"scripts": {
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 4eb191c

Please sign in to comment.