Skip to content

Commit

Permalink
Cleanup console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
ricktu288 committed Dec 27, 2023
1 parent 3c2b681 commit cd18b0c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion simulator/js/canvasPainter.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CanvasPainter {
* @method cls
**/
cls() {
console.log([this.scale, 0, 0, this.scale, this.origin.x, this.origin.y])
//console.log([this.scale, 0, 0, this.scale, this.origin.x, this.origin.y])
if (this.ctx.constructor !== C2S) {
// only do this when not being exported to SVG to avoid bug
this.ctx.setTransform(1, 0, 0, 1, 0, 0);
Expand Down
10 changes: 5 additions & 5 deletions simulator/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function canvas_onmousemove(e) {
if (!isConstructing && draggingObj == -1 && !document.getElementById('lockobjs').checked) {
// highlight object under mouse cursor
var ret = selectionSearch(mouse_nogrid)[0];
console.log(mouse_nogrid);
//console.log(mouse_nogrid);
var newMouseObj = (ret.targetObj_index == -1) ? null : objs[ret.targetObj_index];
if (mouseObj != newMouseObj) {
mouseObj = newMouseObj;
Expand Down Expand Up @@ -449,7 +449,7 @@ function finishHandleCreation(point) {


function canvas_ondblclick(e) {
console.log("dblclick");
//console.log("dblclick");
var mouse = graphs.point((e.pageX - e.target.offsetLeft - origin.x) / scale, (e.pageY - e.target.offsetTop - origin.y) / scale); //滑鼠實際位置(一律不使用格線) The real position of the mouse (never use grid here)
if (isConstructing) {
}
Expand All @@ -471,7 +471,7 @@ function canvas_ondblclick(e) {
document.getElementById('xybox').style.display = '';
document.getElementById('xybox').select();
document.getElementById('xybox').setSelectionRange(1, document.getElementById('xybox').value.length - 1);
console.log("show xybox");
//console.log("show xybox");
xyBox_cancelContextMenu = true;

return;
Expand All @@ -494,7 +494,7 @@ function canvas_ondblclick(e) {
document.getElementById('xybox').style.display = '';
document.getElementById('xybox').select();
document.getElementById('xybox').setSelectionRange(1, document.getElementById('xybox').value.length - 1);
console.log("show xybox");
//console.log("show xybox");
xyBox_cancelContextMenu = true;
}
}
Expand Down Expand Up @@ -641,7 +641,7 @@ function cloneObj(index) {
indices.push(objs[index].controlPoints[j].targetObj_index);
}
}
console.log(indices);
//console.log(indices);
for (var j in indices) {
if (objs[indices[j]].type != "handle") {
cloneObj(indices[j]);
Expand Down
2 changes: 1 addition & 1 deletion simulator/js/equation.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function evaluateLatex(latex) {
.replaceAll("\\operatorname{abs}","abs")
.replaceAll("\\left|","|")
.replaceAll("\\right|","|");
console.log(latex_replaced);
//console.log(latex_replaced);
return evaluatex(
latex_replaced,
{
Expand Down
18 changes: 9 additions & 9 deletions simulator/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ window.onload = function (e) {


canvas.addEventListener('mousedown', function (e) {
console.log("mousedown");
//console.log("mousedown");
//document.getElementById('objAttr_text').blur();
// TODO: check that commenting out the above line does not cause problem.

Expand All @@ -90,12 +90,12 @@ window.onload = function (e) {
});

canvas.addEventListener('mousemove', function (e) {
console.log("mousemove");
//console.log("mousemove");
canvas_onmousemove(e);
});

canvas.addEventListener('mouseup', function (e) {
console.log("mouseup");
//console.log("mouseup");
canvas_onmouseup(e);
});

Expand Down Expand Up @@ -128,7 +128,7 @@ window.onload = function (e) {
canvas_onmouseup(e);
}
} else {
console.log("touchstart");
//console.log("touchstart");
document.body.focus();
canvas_onmousemove(e);
canvas_onmousedown(e);
Expand All @@ -137,7 +137,7 @@ window.onload = function (e) {

canvas.addEventListener('touchmove', function (e) {
e.preventDefault();
console.log("touchmove");
//console.log("touchmove");
if (e.touches.length === 2) {
// Pinch to zoom

Expand Down Expand Up @@ -186,15 +186,15 @@ window.onload = function (e) {
});

canvas.addEventListener('touchend', function (e) {
console.log("touchend");
//console.log("touchend");
if (e.touches.length < 2) {
initialPinchDistance = null;
canvas_onmouseup(e);
}
});

canvas.addEventListener('touchcancel', function (e) {
console.log("touchcancel");
//console.log("touchcancel");
initialPinchDistance = null;
if (isConstructing || draggingObj >= 0) {
canvas_onmouseup(e);
Expand Down Expand Up @@ -934,7 +934,7 @@ function JSONInput() {
} else {
var rescaleFactor = jsonData.height / canvasHeight;
}
console.log(rescaleFactor);
//console.log(rescaleFactor);
scale = jsonData.scale / rescaleFactor;
origin.x = jsonData.origin.x / rescaleFactor;
origin.y = jsonData.origin.y / rescaleFactor;
Expand Down Expand Up @@ -1049,7 +1049,7 @@ function getLink() {
JsonUrl('lzma').compress(JSON.parse(document.getElementById('textarea1').value)).then(output => {
window.location.hash = '#' + output;
var fullURL = "https://phydemo.app/ray-optics/simulator/#" + output;
console.log(fullURL.length);
//console.log(fullURL.length);
navigator.clipboard.writeText(fullURL);
if (fullURL.length > 2043) {
alert(getMsg("get_link_warning"));
Expand Down
2 changes: 1 addition & 1 deletion simulator/js/objs/curvedmirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ objTypes['curvedmirror'] = {
outxFinal = outxA * (frac-0.5) + outx * (1.5-frac);
outyFinal = outyA * (frac-0.5) + outy * (1.5-frac);
}
console.log(frac);
//console.log(frac);
ray.p2 = graphs.point(outxFinal, outyFinal);
}
}
Expand Down
2 changes: 1 addition & 1 deletion simulator/js/objs/refractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ objTypes['refractor'] = {

fillGlass: function(n, obj, ctx, aboveLight)
{
console.log(aboveLight)
//console.log(aboveLight)
if (aboveLight) {
// Draw the highlight only
ctx.globalAlpha = 0.1;
Expand Down
2 changes: 1 addition & 1 deletion simulator/js/objs/sphericallens.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ objTypes['sphericallens'] = {
var edgeShift1 = d/2 - curveShift1;
var edgeShift2 = d/2 + curveShift2;

console.log([edgeShift1,edgeShift2,d])
//console.log([edgeShift1,edgeShift2,d])

if (isNaN(curveShift1) || isNaN(curveShift2)) {
// invalid lens. Store the parameters so we can restore them later.
Expand Down
6 changes: 3 additions & 3 deletions simulator/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function updateUIText(elememt = document) {
translated++;
}
}
console.log([lang1, total, translated]);
//console.log([lang1, total, translated]);

document.getElementById('lang-' + lang1).innerText = Math.round(translated/total*100) + '%';
}
Expand Down Expand Up @@ -255,7 +255,7 @@ function initTools() {
if (element.id && element.id.startsWith('tool_')) {
const toolId = element.id.replace('tool_', '').replace('_mobile', '');
element.addEventListener('click', (event) => {
console.log('tool_' + toolId);
//console.log('tool_' + toolId);
toolbtn_clicked(toolId);
});
}
Expand All @@ -281,7 +281,7 @@ function initModes() {
if (element.id && element.id.startsWith('mode_')) {
const modeId = element.id.replace('mode_', '').replace('_mobile', '');
element.addEventListener('click', (event) => {
console.log('mode_' + modeId);
//console.log('mode_' + modeId);
modebtn_clicked(modeId);
createUndoPoint();
});
Expand Down

0 comments on commit cd18b0c

Please sign in to comment.