change preview.maxspeed to preview.speeds and emit an object with min/max
This commit is contained in:
parent
c42fc7ee73
commit
abe27001ca
5 changed files with 32 additions and 13 deletions
|
|
@ -629,12 +629,25 @@
|
|||
opacity: flat ? 0.5 : 1
|
||||
};
|
||||
|
||||
const maxspd = levels.map(level => {
|
||||
return level.map(o => o.speed || 0).reduce((a, v) => Math.max(a,v));
|
||||
}).reduce((a, v) => Math.max(a, v)) + 1;
|
||||
let minspd = Infinity;
|
||||
let maxspd = 0;
|
||||
|
||||
for (let level of levels) {
|
||||
for (let o of level) {
|
||||
if (o.speed) {
|
||||
minspd = Math.min(minspd, o.speed);
|
||||
maxspd = Math.max(maxspd, o.speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// const maxspd = levels.map(level => {
|
||||
// return level.map(o => o.speed || 0).reduce((a, v) => Math.max(a,v));
|
||||
// }).reduce((a, v) => Math.max(a, v)) + 1;
|
||||
|
||||
// for reporting
|
||||
self.worker.print.maxSpeed = maxspd - 1;
|
||||
self.worker.print.minSpeed = minspd;
|
||||
self.worker.print.maxSpeed = maxspd;
|
||||
self.worker.print.thinColor = thin;
|
||||
self.worker.print.flatColor = flat;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue