UI: fixed bug when coordinates tooltip didn't take into account window scrolls. Fixed bug when some items on canvas could be lost after resizing
This commit is contained in:
@@ -26,7 +26,7 @@ function perimeterDebugRequest() {
|
|||||||
console.log("Got debug response");
|
console.log("Got debug response");
|
||||||
var debugInfo = DebugResponse.decode64(data);
|
var debugInfo = DebugResponse.decode64(data);
|
||||||
console.log("Drawing");
|
console.log("Drawing");
|
||||||
drawDebug(debugInfo);
|
drawDebug(debugInfo, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -137,7 +137,7 @@ function init() {
|
|||||||
var mousePos = getMousePos(evt);
|
var mousePos = getMousePos(evt);
|
||||||
var message = "(" + mousePos.x + "," + mousePos.y + ")";
|
var message = "(" + mousePos.x + "," + mousePos.y + ")";
|
||||||
tooltip[0].textContent = message;
|
tooltip[0].textContent = message;
|
||||||
tooltip.offset( {top: (evt.clientY + 20), left: (evt.clientX + 20) } );
|
tooltip.offset( {top: (evt.pageY + 20), left: (evt.pageX + 20) } );
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ function drawAxis() {
|
|||||||
drawLine(createLine(0, 1, 0), "black", 2)
|
drawLine(createLine(0, 1, 0), "black", 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawDebug(data) {
|
function drawDebug(data, attempt) {
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
var segments = [];
|
var segments = [];
|
||||||
@@ -247,4 +247,9 @@ function drawDebug(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawAxis()
|
drawAxis()
|
||||||
|
|
||||||
|
// re-draw everything to be sure that all resizing and centering will take their place
|
||||||
|
if (attempt == 1) {
|
||||||
|
drawDebug(data, 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user