Skip to content

Commit

Permalink
Show mouse coordinates in status box (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricktu288 committed Apr 13, 2024
1 parent e912af6 commit d1275a3
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 5 deletions.
5 changes: 4 additions & 1 deletion simulator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,10 @@ <h5 class="modal-title" id="staticBackdropLabel" data-text="language"></h5>
<div class="spinner-border text-secondary" role="status"></div>
<span data-text="processing"></span>
</div>
<div id="status" style="display: none;"></div>
<div id="status" style="display: none;">
<div id="mouseCoordinates"></div>
<div id="simulatorStatus"></div>
</div>
</div>

<!-- Footer buttons -->
Expand Down
2 changes: 2 additions & 0 deletions simulator/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ function canvas_onmousemove(e) {
mousePos = mousePos2;


document.getElementById('mouseCoordinates').innerHTML = getMsg('mouse_coordinates') + "(" + Math.round(mousePos.x) + "," + Math.round(mousePos.y) + ")";

if (isConstructing) {
// highlight object being constructed
mouseObj = scene.objs[scene.objs.length - 1];
Expand Down
1 change: 1 addition & 0 deletions simulator/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ window.onload = function (e) {
if (lastDeviceIsTouch && Date.now() - lastTouchTime < 500) return;
lastDeviceIsTouch = false;
mouseObj = -1;
document.getElementById('mouseCoordinates').innerHTML = "";
draw(true, true)
});

Expand Down
8 changes: 4 additions & 4 deletions simulator/js/simulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function shootWaitingRays() {
timerID = setTimeout(shootWaitingRays, firstBreak ? 100:1);
firstBreak = false;
document.getElementById('forceStop').style.display = '';
document.getElementById('status').innerHTML = getMsg("ray_count") + shotRayCount + '<br>' + getMsg("total_truncation") + totalTruncation.toFixed(3) + '<br>' + getMsg("time_elapsed") + (new Date() - drawBeginTime) + '<br>';
document.getElementById('simulatorStatus').innerHTML = getMsg("ray_count") + shotRayCount + '<br>' + getMsg("total_truncation") + totalTruncation.toFixed(3) + '<br>' + getMsg("time_elapsed") + (new Date() - drawBeginTime) + '<br>';

draw(true, true); // Redraw the scene.objs to avoid outdated information (e.g. detector readings).
return;
Expand Down Expand Up @@ -619,16 +619,16 @@ function shootWaitingRays() {

if (forceStop)
{
document.getElementById('status').innerHTML = getMsg("ray_count") + shotRayCount + '<br>' + getMsg("total_truncation") + totalTruncation.toFixed(3) + '<br>' + getMsg("time_elapsed") + (new Date() - drawBeginTime) + '<br>' + getMsg("force_stopped");
document.getElementById('simulatorStatus').innerHTML = getMsg("ray_count") + shotRayCount + '<br>' + getMsg("total_truncation") + totalTruncation.toFixed(3) + '<br>' + getMsg("time_elapsed") + (new Date() - drawBeginTime) + '<br>' + getMsg("force_stopped");
forceStop = false;
}
else if (hasExceededTime)
{
//document.getElementById('status').innerHTML = getMsg("ray_count") + shotRayCount + '<br>' + getMsg("total_truncation") + totalTruncation;
//document.getElementById('simulatorStatus').innerHTML = getMsg("ray_count") + shotRayCount + '<br>' + getMsg("total_truncation") + totalTruncation;
}
else
{
document.getElementById('status').innerHTML = getMsg("ray_count") + shotRayCount + '<br>' + getMsg("total_truncation") + totalTruncation.toFixed(3) + '<br>' + getMsg("time_elapsed") + (new Date() - drawBeginTime);
document.getElementById('simulatorStatus').innerHTML = getMsg("ray_count") + shotRayCount + '<br>' + getMsg("total_truncation") + totalTruncation.toFixed(3) + '<br>' + getMsg("time_elapsed") + (new Date() - drawBeginTime);
}
document.getElementById('forceStop').style.display = 'none';
//ctx.stroke();
Expand Down
4 changes: 4 additions & 0 deletions simulator/locales/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -841,5 +841,9 @@ locales["de"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
3 changes: 3 additions & 0 deletions simulator/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,5 +749,8 @@ locales["en"] = {
},
"force_stopped": {
"message": "Force stopped."
},
"mouse_coordinates": {
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,5 +760,9 @@ locales["es"] = {
},
"force_stopped": {
"message": "Fuerza detenida."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,5 +894,9 @@ locales["fr"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,5 +998,9 @@ locales["ja"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,5 +998,9 @@ locales["ko"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,5 +910,9 @@ locales["nl"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,5 +785,9 @@ locales["pl"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,5 +898,9 @@ locales["ru"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/si.js
Original file line number Diff line number Diff line change
Expand Up @@ -907,5 +907,9 @@ locales["si"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
4 changes: 4 additions & 0 deletions simulator/locales/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,5 +998,9 @@ locales["LOCALE_ID"] = {
"force_stopped": {
"incomplete": true,
"message": "Force stopped."
},
"mouse_coordinates": {
"incomplete": true,
"message": "Mouse coordinates: "
}
}
3 changes: 3 additions & 0 deletions simulator/locales/zh_CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,5 +749,8 @@ locales["zh-CN"] = {
},
"force_stopped": {
"message": "已强制终止。"
},
"mouse_coordinates": {
"message": "滑鼠座标:"
}
}
4 changes: 4 additions & 0 deletions simulator/locales/zh_TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,5 +749,9 @@ locales["zh-TW"] = {
},
"force_stopped": {
"message": "已強制終止。"
},
"mouse_coordinates": {

"message": "滑鼠座標:"
}
}

0 comments on commit d1275a3

Please sign in to comment.