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 803b14a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 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
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 803b14a

Please sign in to comment.