Spaces:
Running
Running
Add 1 files
Browse files- index.html +9 -12
index.html
CHANGED
|
@@ -187,7 +187,7 @@
|
|
| 187 |
</div>
|
| 188 |
</div>
|
| 189 |
|
| 190 |
-
<button id="convertBtn" class="w-full bg-indigo-600 hover:bg-indigo-
|
| 191 |
<i class="fas fa-magic mr-2"></i> Convert to SVG
|
| 192 |
</button>
|
| 193 |
</div>
|
|
@@ -474,8 +474,13 @@
|
|
| 474 |
let progress = 0;
|
| 475 |
const progressInterval = setInterval(() => {
|
| 476 |
progress += Math.random() * 10;
|
| 477 |
-
if (progress >
|
| 478 |
progressBar.style.width = progress + '%';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
}, 200);
|
| 480 |
|
| 481 |
// Process image after a short delay to allow UI to update
|
|
@@ -511,9 +516,6 @@
|
|
| 511 |
// Use Potrace to vectorize the image
|
| 512 |
const imageDataURL = tempCanvas.toDataURL('image/png');
|
| 513 |
|
| 514 |
-
// Update progress
|
| 515 |
-
progressBar.style.width = '95%';
|
| 516 |
-
|
| 517 |
// Vectorize using Potrace
|
| 518 |
potrace.loadImageFromUrl(imageDataURL);
|
| 519 |
potrace.setParameters({
|
|
@@ -524,16 +526,11 @@
|
|
| 524 |
});
|
| 525 |
|
| 526 |
potrace.process(() => {
|
| 527 |
-
clearInterval(progressInterval);
|
| 528 |
-
progressBar.style.width = '100%';
|
| 529 |
-
|
| 530 |
// Get SVG data
|
| 531 |
const svg = potrace.getSVG(1, settings.transparent ? 'none' : '#ffffff');
|
| 532 |
|
| 533 |
-
// Show result
|
| 534 |
-
|
| 535 |
-
showResult(svg);
|
| 536 |
-
}, 300);
|
| 537 |
});
|
| 538 |
}, 500);
|
| 539 |
}
|
|
|
|
| 187 |
</div>
|
| 188 |
</div>
|
| 189 |
|
| 190 |
+
<button id="convertBtn" class="w-full bg-indigo-600 hover:bg-indigo-7text-white py-2 px-4 rounded-md font-medium transition disabled:opacity-50 disabled:cursor-not-allowed" disabled>
|
| 191 |
<i class="fas fa-magic mr-2"></i> Convert to SVG
|
| 192 |
</button>
|
| 193 |
</div>
|
|
|
|
| 474 |
let progress = 0;
|
| 475 |
const progressInterval = setInterval(() => {
|
| 476 |
progress += Math.random() * 10;
|
| 477 |
+
if (progress > 100) progress = 100; // Changed from 90 to 100
|
| 478 |
progressBar.style.width = progress + '%';
|
| 479 |
+
|
| 480 |
+
// Clear interval when we reach 100%
|
| 481 |
+
if (progress >= 100) {
|
| 482 |
+
clearInterval(progressInterval);
|
| 483 |
+
}
|
| 484 |
}, 200);
|
| 485 |
|
| 486 |
// Process image after a short delay to allow UI to update
|
|
|
|
| 516 |
// Use Potrace to vectorize the image
|
| 517 |
const imageDataURL = tempCanvas.toDataURL('image/png');
|
| 518 |
|
|
|
|
|
|
|
|
|
|
| 519 |
// Vectorize using Potrace
|
| 520 |
potrace.loadImageFromUrl(imageDataURL);
|
| 521 |
potrace.setParameters({
|
|
|
|
| 526 |
});
|
| 527 |
|
| 528 |
potrace.process(() => {
|
|
|
|
|
|
|
|
|
|
| 529 |
// Get SVG data
|
| 530 |
const svg = potrace.getSVG(1, settings.transparent ? 'none' : '#ffffff');
|
| 531 |
|
| 532 |
+
// Show result
|
| 533 |
+
showResult(svg);
|
|
|
|
|
|
|
| 534 |
});
|
| 535 |
}, 500);
|
| 536 |
}
|