mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Change remaining for of loops to regular ones (#7103)
This commit is contained in:
parent
8245da44f5
commit
7397a41fac
@ -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);
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user