()
| 491 | } |
| 492 | |
| 493 | function bindResize() { |
| 494 | var sX = 0, |
| 495 | sY = 0; |
| 496 | var iX = 0, |
| 497 | iY = 0; |
| 498 | var isDownTB = false; |
| 499 | var isDownLR = false; |
| 500 | document.addEventListener("dblclick", function() { |
| 501 | isDownTB = false; |
| 502 | isDownLR = false; |
| 503 | }); |
| 504 | $("control-resize-lr").addEventListener("mousedown", function(e) { |
| 505 | sX = e.clientX; |
| 506 | iX = $("player-unit").offsetWidth; |
| 507 | iY = $("player").offsetHeight; |
| 508 | $("commentCanvas").style.border = "1px solid #0ff"; |
| 509 | isDownLR = true; |
| 510 | $("c-region").style.display = ""; |
| 511 | }); |
| 512 | $("control-resize-tb").addEventListener("mousedown", function(e) { |
| 513 | sY = e.clientY; |
| 514 | iX = $("player-unit").offsetWidth; |
| 515 | iY = $("player").offsetHeight; |
| 516 | $("commentCanvas").style.border = "1px solid #0ff"; |
| 517 | isDownTB = true; |
| 518 | $("c-region").style.display = ""; |
| 519 | }); |
| 520 | document.addEventListener("mousemove", function(e) { |
| 521 | if (isDownTB) { |
| 522 | var yDelta = e.clientY - sY; |
| 523 | $("player").style.height = (iY + yDelta) + "px"; |
| 524 | $("c-region").innerHTML = iX + "x" + (iY + yDelta); |
| 525 | } else if (isDownLR) { |
| 526 | var xDelta = e.clientX - sX; |
| 527 | $("player-unit").style.width = (iX + xDelta) + "px"; |
| 528 | $("c-region").innerHTML = (iX + xDelta) + "x" + iY; |
| 529 | } |
| 530 | }); |
| 531 | document.addEventListener("mouseup", function(e) { |
| 532 | if ((isDownTB || isDownLR)) { |
| 533 | if (trace) { |
| 534 | trace("Resize to " + $("commentCanvas").offsetWidth + "x" + $("commentCanvas").offsetHeight); |
| 535 | } |
| 536 | cm.setBounds(); |
| 537 | $("commentCanvas").style.border = "0px"; |
| 538 | $("c-region").style.display = "none"; |
| 539 | cm.setBounds(); |
| 540 | } |
| 541 | isDownTB = false; |
| 542 | isDownLR = false; |
| 543 | }); |
| 544 | }; |
| 545 | |
| 546 | function bindDebugger() { |
| 547 | var output = $("debugger-output"); |
no test coverage detected