chao 1 year ago
parent
commit
22c1c2b482
1 changed files with 0 additions and 64 deletions
  1. 0 64
      test.html

+ 0 - 64
test.html

@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-  <meta charset="UTF-8">
-  <meta name="viewport" content="width=device-width, initial-scale=1.0">
-  <title>Canvas Save Scaled Image</title>
-  <script>
-    document.domain = "cocorobo.cn"
-  </script>
-</head>
-
-<body>
-  <!-- <canvas id="myCanvas" width="400" height="200" style="border:1px solid #000;"></canvas>
-  <button id="saveScaledImage">Save Scaled Image</button>
-
-  <script>
-    document.addEventListener('DOMContentLoaded', () => {
-      const canvas = document.getElementById('myCanvas');
-      const context = canvas.getContext('2d');
-      const saveScaledImageBtn = document.getElementById('saveScaledImage');
-
-      // Draw something on the canvas
-      context.fillStyle = 'green';
-      context.fillRect(10, 10, 100, 100);
-
-      saveScaledImageBtn.addEventListener('click', () => {
-        // Create a temporary canvas for scaling
-        const tempCanvas = document.createElement('canvas');
-        const tempContext = tempCanvas.getContext('2d');
-        
-        // Set the dimensions of the temporary canvas (scaled size)
-        const scaledWidth = 200;  // Change this to your desired width
-        const scaledHeight = 100; // Change this to your desired height
-        tempCanvas.width = scaledWidth;
-        tempCanvas.height = scaledHeight;
-
-        // Draw the original canvas content on the temporary canvas with scaling
-        tempContext.drawImage(canvas, 0, 0, canvas.width, canvas.height, 0, 0, scaledWidth, scaledHeight);
-
-        // Save the scaled canvas content as an image
-        const scaledImageDataURL = tempCanvas.toDataURL('image/png');
-        console.log('Scaled Canvas Data URL:', scaledImageDataURL);
-
-        // Optionally, open a new window and display the scaled image
-        const scaledImageWindow = window.open('', '_blank');
-        scaledImageWindow.document.write('<img src="' + scaledImageDataURL + '" />');
-      });
-    });
-  </script> -->
-  <iframe src="https://metagpt.cocorobo.cn/dist/index.html" id="123" frameborder="0"></iframe>
-</body>
-
-</html>
-<script>
-  window.addEventListener('message', function (e) {
-    console.log(e) //{data:'params'}
-    // fatherFunction()
-  })
-  window.onload = function(){
-    let ifm = document.getElementById("123")
-    console.log("ifm.contentWindow",ifm.contentWindow)
-  }
-</script>