|
|
|
@ -96,7 +96,6 @@ function createLine(points, id, end) {
|
|
|
|
|
[],
|
|
|
|
|
[]
|
|
|
|
|
];
|
|
|
|
|
console.log(newPoints);
|
|
|
|
|
for (let j = 0; j < 3; j++) {
|
|
|
|
|
var maxX = newPoints[2 + (2 * j)] - newPoints[0 + (2 * j)],
|
|
|
|
|
resteX = newPoints[0 + (2 * j)],
|
|
|
|
@ -123,28 +122,62 @@ function createLine(points, id, end) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (change[j].length !== 0) {
|
|
|
|
|
var changePoints = [],
|
|
|
|
|
while (change[j].length !== 0) {
|
|
|
|
|
|
|
|
|
|
newPoints[1 + (2 * (j + 1))] = newPoints[1 + (2 * (j + 1))] + 7;
|
|
|
|
|
var maxX = newPoints[2 + (2 * j)] - newPoints[0 + (2 * j)],
|
|
|
|
|
resteX = newPoints[0 + (2 * j)],
|
|
|
|
|
maxY = newPoints[1 + (2 * j)] - newPoints[3 + (2 * j)],
|
|
|
|
|
isGoingUp = function () {
|
|
|
|
|
if (newPoints[1 + (2 * j)] < newPoints[3 + (2 * j)])
|
|
|
|
|
return true;
|
|
|
|
|
else return false
|
|
|
|
|
}
|
|
|
|
|
resteY = newPoints[3 + (2 * j)];
|
|
|
|
|
iscollapsing = false;
|
|
|
|
|
change[j] = [];
|
|
|
|
|
for (let i = 0; i < 100; i++) {
|
|
|
|
|
iscollapsing = false;
|
|
|
|
|
var x = (maxX / 100 * i) + resteX;
|
|
|
|
|
if (isGoingUp)
|
|
|
|
|
var y = (maxY - (maxY / 100 * i)) + resteY;
|
|
|
|
|
else var y = (maxY / 100 * i) + resteY;
|
|
|
|
|
logiques.forEach(function (logique) {
|
|
|
|
|
if (x > logique.x && x < logique.x + imageWidth && y > logique.y && y < logique.y + imageHeight) iscollapsing = true;
|
|
|
|
|
if (iscollapsing) {
|
|
|
|
|
change[j].push([x, y]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*var changePoints = [],
|
|
|
|
|
YAdd = 4,
|
|
|
|
|
oldX = newPoints[0 + (2 * j)],
|
|
|
|
|
oldY = newPoints[1 + (2 * j)],
|
|
|
|
|
debBaseX = change[j][0][0],
|
|
|
|
|
debBaseY = change[j][0][1],
|
|
|
|
|
debBaseY = change[j][0][1] + YAdd,
|
|
|
|
|
finBaseX = change[j][change[j].length - 1][0],
|
|
|
|
|
finBaseY = change[j][change[j].length - 1][1],
|
|
|
|
|
newStartX = debBaseX - ((finBaseX - debBaseX) / 100 * 10),
|
|
|
|
|
newStartY = debBaseY,
|
|
|
|
|
finBaseY = change[j][change[j].length - 1][1] + YAdd,
|
|
|
|
|
newStartX = debBaseX - ((finBaseX - debBaseX)),
|
|
|
|
|
newStartY = debBaseY + YAdd,
|
|
|
|
|
newStartX2 = debBaseX,
|
|
|
|
|
newStartY2 = debBaseY + (imageHeight / 100 * 40),
|
|
|
|
|
newStartY2 = debBaseY + (imageHeight) + YAdd,
|
|
|
|
|
newStartX3 = finBaseX,
|
|
|
|
|
newStartY3 = finBaseY + (imageHeight / 100 * 40),
|
|
|
|
|
newStartX4 = finBaseX + ((finBaseX - debBaseX) / 100 * 40),
|
|
|
|
|
newStartY4 = finBaseY;
|
|
|
|
|
changePoints.push(newStartY4, newStartX4, newStartY3, newStartX3, newStartY2, newStartX2, newStartY, newStartX);
|
|
|
|
|
newStartY3 = finBaseY + (imageHeight) + YAdd,
|
|
|
|
|
newStartX4 = finBaseX + ((finBaseX - debBaseX)),
|
|
|
|
|
newStartY4 = finBaseY + YAdd,
|
|
|
|
|
indexStart = newPoints.indexOf(newPoints[0 + (2 * j)]);
|
|
|
|
|
console.log(indexStart);
|
|
|
|
|
changePoints.push(newStartY4, newStartX4, newStartY3, newStartX3, newStartY2, newStartX2, newStartY, newStartX, oldY, oldX);
|
|
|
|
|
//on supprime les anciens points :
|
|
|
|
|
//for (let k = 0; k < 4; k++)
|
|
|
|
|
//newPoints.splice(newPoints.indexOf(newPoints[k + (2 * j)]), 1);
|
|
|
|
|
for (let k = 0; k < 8; k++)
|
|
|
|
|
newPoints.splice(newPoints.indexOf(newPoints[0 + (2 * j)]), 0, changePoints[k]);
|
|
|
|
|
newPoints.splice(indexStart, 4);
|
|
|
|
|
console.log(newPoints);
|
|
|
|
|
for (let k = 0; k < changePoints.length; k++)
|
|
|
|
|
newPoints.splice(indexStart, 0, changePoints[k]);
|
|
|
|
|
console.log(newPoints);*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(newPoints);
|
|
|
|
|
|
|
|
|
|
let line = new Konva.Line({
|
|
|
|
|
points: newPoints,
|
|
|
|
|
stroke: colorLineInnactive,
|
|
|
|
|