|
@@ -5,33 +5,26 @@
|
|
|
<title>Equation Editor</title>
|
|
|
</head>
|
|
|
<body style="font-size:30px; font-family: Arial;">
|
|
|
- <div style="position:absolute; width:60px; height:50px; top:0px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addOperatorBlock('+');">+</div>
|
|
|
- <div style="position:absolute; width:60px; height:50px; top:50px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addOperatorBlock('-');">-</div>
|
|
|
- <div style="position:absolute; width:60px; height:50px; top:100px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addOperatorBlock('*');">x</div>
|
|
|
- <div style="position:absolute; width:60px; height:50px; top:150px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addOperatorBlock('/');">/</div>
|
|
|
- <div style="position:absolute; width:60px; height:50px; top:200px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addConstantBlock(prompt('Input value'));">Num</div>
|
|
|
+ <!-- Page -->
|
|
|
+ <div style="position:absolute; width:100%; height:100%; top:0px; left:0px; overflow: hidden;">
|
|
|
+ <!-- Canvas -->
|
|
|
+ <canvas id="canvas" style="position:absolute; width:100%; height:100%; top:0px; left:0px;"></canvas>
|
|
|
+
|
|
|
+ <!-- Buttons -->
|
|
|
+ <div style="position:absolute; width:60px; height:50px; top:0px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addOperatorBlock('+');">+</div>
|
|
|
+ <div style="position:absolute; width:60px; height:50px; top:50px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addOperatorBlock('-');">-</div>
|
|
|
+ <div style="position:absolute; width:60px; height:50px; top:100px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addOperatorBlock('*');">x</div>
|
|
|
+ <div style="position:absolute; width:60px; height:50px; top:150px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addOperatorBlock('/');">/</div>
|
|
|
+ <div style="position:absolute; width:60px; height:50px; top:200px; left:10px; text-align:center; z-index:10; cursor: pointer;" onclick="window.addConstantBlock(prompt('Input value'));">Num</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- Code -->
|
|
|
<script type="text/javascript" src="../build/escher.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
- // Division
|
|
|
- var division = document.createElement("div");
|
|
|
- division.style.position = "absolute";
|
|
|
- division.style.width = "100%";
|
|
|
- division.style.height = "100%";
|
|
|
- division.style.top = "0px";
|
|
|
- division.style.left = "0px";
|
|
|
- division.style.overflow = "hidden";
|
|
|
- document.body.appendChild(division);
|
|
|
-
|
|
|
// Canvas
|
|
|
- var canvas = document.createElement("canvas");
|
|
|
- canvas.style.position = "absolute";
|
|
|
- canvas.style.width = "100%";
|
|
|
- canvas.style.height = "100%";
|
|
|
- canvas.style.top = "0px";
|
|
|
- canvas.style.left = "0px";
|
|
|
+ var canvas = document.getElementById("canvas");
|
|
|
canvas.width = window.innerWidth;
|
|
|
canvas.height = window.innerHeight;
|
|
|
- division.appendChild(canvas);
|
|
|
|
|
|
// Prevent context menu events
|
|
|
document.body.oncontextmenu = function(event)
|
|
@@ -40,7 +33,6 @@
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// Resize canvas on window resize
|
|
|
window.onresize = function()
|
|
|
{
|
|
@@ -127,4 +119,4 @@
|
|
|
renderer.createRenderLoop(group, viewport);
|
|
|
</script>
|
|
|
</body>
|
|
|
-</html>
|
|
|
+</html>
|