master
pisouvigne 5 years ago
parent 9977890deb
commit c533ed5348

@ -91,6 +91,35 @@ function createLine(points, id, end) {
newPoints = [startX, startY, startX + distance20, startY, endX - distance20, endY, endX, endY];
}
for (let j = 0; j < 3; j++) {
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;
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) {
createCircle(x, y, ["l"])
console.log("ouiiiiii")
}
});
}
}
let line = new Konva.Line({
points: newPoints,
stroke: colorLineInnactive,
@ -104,6 +133,7 @@ function createLine(points, id, end) {
};
lines.push(lineObj);
layer.add(line);
if (iscollapsing) line.stroke("red");
}

@ -228,7 +228,6 @@ function changeLineColorBlack(idLine) {
setLineStateFalse(idLine);
let line = stage.findOne("#" + idLine);
line.stroke(colorLineInnactive);
console.log(idLine);
circles.forEach(function (circle) {
if (circle === "circle" + idLine) {
stage.findOne("#circle" + idLine).stroke(colorLineInnactive);
@ -936,9 +935,3 @@ function flip() {
});
rotated = !rotated;
}
function setCanvasScale(x, y) {
console.log(document.getElementsByTagName("canvas"));
var ctx = document.getElementsByTagName("canvas").getContext("2d");
console.log(ctx);
}

@ -582,7 +582,6 @@ function generate2(col, matchs, fork) {
initEndGame();
invertLine();
checkAllSortieLogique();
console.log(circles);
}
function getNumberFork(arr, col) {

@ -8,7 +8,6 @@ function initAllSwitch(mode) {
layer.draw();
lineUpdate(element);
checkEnd(mode);
setCanvasScale();
});
switche.on('mouseover', function () {
document.body.style.cursor = "pointer";

Loading…
Cancel
Save