|
3 | 3 | <head> |
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/> |
6 | | - <title>EzyCad</title> |
| 6 | + <title>EzyCad — run in browser (WebAssembly)</title> |
| 7 | + <meta name="description" content="EzyCad — open-source hobbyist CAD using Open CASCADE (OCCT), Dear ImGui, and OpenGL. Run in your browser via WebAssembly or build from source on GitHub."> |
| 8 | + <meta name="keywords" content="EzyCad, CAD, Open CASCADE, OCCT, ImGui, OpenGL, WebAssembly, CNC, machining, STEP, STL"> |
| 9 | + <link rel="canonical" href="https://trailcode.github.io/EzyCad/EzyCad.html"> |
| 10 | + <meta property="og:title" content="EzyCad — open-source hobbyist CAD"> |
| 11 | + <meta property="og:description" content="Design 2D and 3D parts in your browser. Built with OCCT, Dear ImGui, and OpenGL. Source: github.com/trailcode/EzyCad"> |
| 12 | + <meta property="og:type" content="website"> |
| 13 | + <meta property="og:url" content="https://trailcode.github.io/EzyCad/EzyCad.html"> |
| 14 | + <meta property="og:image" content="https://raw.githubusercontent.com/trailcode/EzyCad/main/doc/gen/AI-gen-splashscreen_05_01_2026_512.png"> |
| 15 | + <meta name="twitter:card" content="summary_large_image"> |
7 | 16 | <style> |
8 | 17 | body { margin: 0; background-color: black } |
9 | 18 | .emscripten { |
|
16 | 25 | height: 100%; |
17 | 26 | overflow: hidden; |
18 | 27 | display: block; |
19 | | - image-rendering: optimizeSpeed; |
20 | | - image-rendering: -moz-crisp-edges; |
21 | | - image-rendering: -o-crisp-edges; |
22 | | - image-rendering: -webkit-optimize-contrast; |
23 | | - image-rendering: optimize-contrast; |
24 | | - image-rendering: crisp-edges; |
25 | | - image-rendering: pixelated; |
26 | | - -ms-interpolation-mode: nearest-neighbor; |
| 28 | + /* Default (smooth) scaling. Do NOT use image-rendering: pixelated here: |
| 29 | + when the canvas backing-store size differs from CSS size (HiDPI), the |
| 30 | + browser upscales the WebGL surface with nearest-neighbor and ImGui text |
| 31 | + looks blocky. */ |
| 32 | + } |
| 33 | + |
| 34 | + /* Loading splash (Emscripten: wasm download + preloads + first frame) */ |
| 35 | + #ezycad-splash { |
| 36 | + position: fixed; |
| 37 | + inset: 0; |
| 38 | + z-index: 20; |
| 39 | + display: flex; |
| 40 | + flex-direction: column; |
| 41 | + align-items: center; |
| 42 | + justify-content: center; |
| 43 | + gap: 1.25rem; |
| 44 | + background: #0a0a0c; |
| 45 | + color: #e8e8ec; |
| 46 | + font-family: system-ui, Segoe UI, Roboto, sans-serif; |
| 47 | + transition: opacity 0.35s ease, visibility 0.35s ease; |
| 48 | + } |
| 49 | + #ezycad-splash.ezycad-splash--hidden { |
| 50 | + opacity: 0; |
| 51 | + visibility: hidden; |
| 52 | + pointer-events: none; |
| 53 | + } |
| 54 | + #ezycad-splash h1 { |
| 55 | + margin: 0; |
| 56 | + font-size: 1.75rem; |
| 57 | + font-weight: 600; |
| 58 | + letter-spacing: 0.04em; |
| 59 | + } |
| 60 | + #ezycad-splash-status { |
| 61 | + margin: 0; |
| 62 | + min-height: 1.25em; |
| 63 | + font-size: 0.85rem; |
| 64 | + color: #9898a8; |
| 65 | + text-align: center; |
| 66 | + max-width: 90vw; |
| 67 | + } |
| 68 | + .ezycad-splash-spinner { |
| 69 | + width: 40px; |
| 70 | + height: 40px; |
| 71 | + border: 3px solid #2a2a32; |
| 72 | + border-top-color: #5a9fd4; |
| 73 | + border-radius: 50%; |
| 74 | + animation: ezycad-spin 0.85s linear infinite; |
| 75 | + } |
| 76 | + @keyframes ezycad-spin { |
| 77 | + to { transform: rotate(360deg); } |
27 | 78 | } |
28 | 79 | </style> |
29 | 80 | </head> |
30 | 81 | <body> |
| 82 | + <div id="ezycad-splash" aria-live="polite"> |
| 83 | + <div class="ezycad-splash-spinner" role="status" aria-label="Loading"></div> |
| 84 | + <h1>EzyCad</h1> |
| 85 | + <p id="ezycad-splash-status"></p> |
| 86 | + </div> |
31 | 87 | <canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas> |
32 | 88 | <script type='text/javascript'> |
33 | | - var Module = { |
| 89 | + (function() { |
| 90 | + var splash = document.getElementById('ezycad-splash'); |
| 91 | + var statusEl = document.getElementById('ezycad-splash-status'); |
| 92 | + |
| 93 | + function setSplashStatus(text) { |
| 94 | + if (!statusEl) return; |
| 95 | + if (text == null || text === '') { |
| 96 | + statusEl.textContent = ''; |
| 97 | + return; |
| 98 | + } |
| 99 | + var s = String(text).replace(/\s+/g, ' ').trim(); |
| 100 | + statusEl.textContent = s; |
| 101 | + } |
| 102 | + |
| 103 | + function hideSplash() { |
| 104 | + if (!splash) return; |
| 105 | + splash.classList.add('ezycad-splash--hidden'); |
| 106 | + } |
| 107 | + |
| 108 | + window.Module = { |
34 | 109 | preRun: [], |
35 | | - postRun: [], |
| 110 | + postRun: [ |
| 111 | + function() { |
| 112 | + // Let WebGL + ImGui paint once before removing the overlay (avoids a black flash). |
| 113 | + requestAnimationFrame(function() { |
| 114 | + requestAnimationFrame(hideSplash); |
| 115 | + }); |
| 116 | + } |
| 117 | + ], |
36 | 118 | print: (function() { |
37 | 119 | return function(text) { |
38 | 120 | text = Array.prototype.slice.call(arguments).join(' '); |
|
52 | 134 | })(), |
53 | 135 | setStatus: function(text) { |
54 | 136 | console.log("status: " + text); |
| 137 | + setSplashStatus(text); |
55 | 138 | }, |
56 | 139 | monitorRunDependencies: function(left) { |
57 | | - // no run dependencies to log |
| 140 | + if (left > 0) |
| 141 | + setSplashStatus('Preparing assets… (' + left + ' remaining)'); |
| 142 | + else |
| 143 | + setSplashStatus('Starting…'); |
| 144 | + }, |
| 145 | + onAbort: function(reason) { |
| 146 | + setSplashStatus(reason ? ('Load aborted: ' + reason) : 'Load aborted'); |
58 | 147 | } |
59 | 148 | }; |
| 149 | + })(); |
| 150 | + |
60 | 151 | window.onerror = function() { |
61 | 152 | console.log("onerror: " + event); |
62 | 153 | }; |
|
0 commit comments