Replace Array.prototype.find with simple for-loop

This commit is contained in:
Eduard Belozertsev
2026-01-13 13:44:11 +07:00
parent 3840001254
commit 0d84e3a74c

View File

@ -2144,9 +2144,15 @@ function (window, undefined) {
}
if (AscFormat.isRealNumber(epsilon)) {
const firstPointCommand = this.ArrPathCommand.find(function (command) {
return command.id === AscFormat.moveTo || command.id === AscFormat.lineTo;
});
let firstPointCommand = null;
for (let i = 0; i < this.ArrPathCommand.length; i++) {
const command = this.ArrPathCommand[i];
if (command.id === AscFormat.moveTo || command.id === AscFormat.lineTo) {
firstPointCommand = command;
break;
}
}
const firstPoint = firstPointCommand ? { x: firstPointCommand.X, y: firstPointCommand.Y } : null;
const lastPoint = getPathEndPoint(this.ArrPathCommand);