]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Change remaining `for of` loops to regular ones (#7103)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Fri, 14 Feb 2020 19:12:23 +0000 (21:12 +0200)
committerGitHub <noreply@github.com>
Fri, 14 Feb 2020 19:12:23 +0000 (14:12 -0500)
src/helpers/helpers.segment.js
src/plugins/plugin.filler.js

index 8415fd81f43285fc014ab34904c935ad48f3f8e5..f40d8a8894b4242860d72db4bb1a7f1897a7fbee 100644 (file)
@@ -122,9 +122,10 @@ export function _boundSegment(segment, points, bounds) {
  */
 export function _boundSegments(line, bounds) {
        const result = [];
+       const segments = line.segments;
 
-       for (const segment of line.segments) {
-               const sub = _boundSegment(segment, line.points, bounds);
+       for (let i = 0; i < segments.length; i++) {
+               const sub = _boundSegment(segments[i], line.points, bounds);
                if (sub.length) {
                        result.push(...sub);
                }
index f9114e51600b8d22f6311ba596b989a9618fd893..4843c9c3f7e6a32d6af988b6b5452cac6fdad5e4 100644 (file)
@@ -265,6 +265,7 @@ function _getEdge(a, b, prop, fn) {
 }
 
 function _segments(line, target, property) {
+       const segments = line.segments;
        const points = line.points;
        const tpoints = target.points;
        const parts = [];
@@ -280,7 +281,8 @@ function _segments(line, target, property) {
                }
        }
 
-       for (const segment of line.segments) {
+       for (let i = 0; i < segments.length; i++) {
+               const segment = segments[i];
                const bounds = getBounds(property, points[segment.start], points[segment.end], segment.loop);
 
                if (!target.segments) {
@@ -298,13 +300,14 @@ function _segments(line, target, property) {
                // Get all segments from `target` that intersect the bounds of current segment of `line`
                const subs = _boundSegments(target, bounds);
 
-               for (const sub of subs) {
+               for (let j = 0; j < subs.length; ++j) {
+                       const sub = subs[j];
                        const subBounds = getBounds(property, tpoints[sub.start], tpoints[sub.end], sub.loop);
                        const fillSources = _boundSegment(segment, points, subBounds);
 
-                       for (const source of fillSources) {
+                       for (let k = 0; k < fillSources.length; k++) {
                                parts.push({
-                                       source,
+                                       source: fillSources[k],
                                        target: sub,
                                        start: {
                                                [property]: _getEdge(bounds, subBounds, 'start', Math.max)