Spaces:
Running
Running
خطوط لبه صفحات را روی عکس نمایش بده با همپوشانی اعمال شده
Browse files
script.js
CHANGED
|
@@ -171,7 +171,8 @@ let uploadedImage = null;
|
|
| 171 |
sy = Math.max(0, sy);
|
| 172 |
sw = Math.min(uploadedImage.width - sx, sw);
|
| 173 |
sh = Math.min(uploadedImage.height - sy, sh);
|
| 174 |
-
// Draw the image segment
|
|
|
|
| 175 |
if (orient === 'diagonal') {
|
| 176 |
// For diagonal orientation, rotate the canvas
|
| 177 |
ctx.translate(canvas.width/2, canvas.height/2);
|
|
@@ -190,6 +191,50 @@ let uploadedImage = null;
|
|
| 190 |
0, 0, canvas.width, canvas.height
|
| 191 |
);
|
| 192 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
// Add cutting guides if enabled
|
| 194 |
if (showGuides) {
|
| 195 |
const guideSize = 20;
|
|
|
|
| 171 |
sy = Math.max(0, sy);
|
| 172 |
sw = Math.min(uploadedImage.width - sx, sw);
|
| 173 |
sh = Math.min(uploadedImage.height - sy, sh);
|
| 174 |
+
// Draw the image segment with border
|
| 175 |
+
ctx.save();
|
| 176 |
if (orient === 'diagonal') {
|
| 177 |
// For diagonal orientation, rotate the canvas
|
| 178 |
ctx.translate(canvas.width/2, canvas.height/2);
|
|
|
|
| 191 |
0, 0, canvas.width, canvas.height
|
| 192 |
);
|
| 193 |
}
|
| 194 |
+
|
| 195 |
+
// Draw border around the image segment
|
| 196 |
+
ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)';
|
| 197 |
+
ctx.lineWidth = 2;
|
| 198 |
+
ctx.strokeRect(0, 0, canvas.width, canvas.height);
|
| 199 |
+
|
| 200 |
+
// Draw overlap indicators
|
| 201 |
+
ctx.strokeStyle = 'rgba(0, 0, 255, 0.5)';
|
| 202 |
+
ctx.lineWidth = 1;
|
| 203 |
+
ctx.setLineDash([5, 5]);
|
| 204 |
+
|
| 205 |
+
// Left overlap
|
| 206 |
+
if (col > 0) {
|
| 207 |
+
ctx.beginPath();
|
| 208 |
+
ctx.moveTo(0, 0);
|
| 209 |
+
ctx.lineTo(0, canvas.height);
|
| 210 |
+
ctx.stroke();
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
// Right overlap
|
| 214 |
+
if (col < gridSize - 1) {
|
| 215 |
+
ctx.beginPath();
|
| 216 |
+
ctx.moveTo(canvas.width, 0);
|
| 217 |
+
ctx.lineTo(canvas.width, canvas.height);
|
| 218 |
+
ctx.stroke();
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
// Top overlap
|
| 222 |
+
if (row > 0) {
|
| 223 |
+
ctx.beginPath();
|
| 224 |
+
ctx.moveTo(0, 0);
|
| 225 |
+
ctx.lineTo(canvas.width, 0);
|
| 226 |
+
ctx.stroke();
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
// Bottom overlap
|
| 230 |
+
if (row < gridSize - 1) {
|
| 231 |
+
ctx.beginPath();
|
| 232 |
+
ctx.moveTo(0, canvas.height);
|
| 233 |
+
ctx.lineTo(canvas.width, canvas.height);
|
| 234 |
+
ctx.stroke();
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
ctx.restore();
|
| 238 |
// Add cutting guides if enabled
|
| 239 |
if (showGuides) {
|
| 240 |
const guideSize = 20;
|
style.css
CHANGED
|
@@ -20,13 +20,15 @@
|
|
| 20 |
height: 100%;
|
| 21 |
object-fit: cover;
|
| 22 |
}
|
| 23 |
-
|
| 24 |
.cutting-guide {
|
| 25 |
position: absolute;
|
| 26 |
background-color: rgba(255, 0, 0, 0.3);
|
| 27 |
z-index: 10;
|
| 28 |
}
|
| 29 |
|
|
|
|
|
|
|
|
|
|
| 30 |
.page-number {
|
| 31 |
position: absolute;
|
| 32 |
bottom: 5px;
|
|
|
|
| 20 |
height: 100%;
|
| 21 |
object-fit: cover;
|
| 22 |
}
|
|
|
|
| 23 |
.cutting-guide {
|
| 24 |
position: absolute;
|
| 25 |
background-color: rgba(255, 0, 0, 0.3);
|
| 26 |
z-index: 10;
|
| 27 |
}
|
| 28 |
|
| 29 |
+
.poster-page canvas {
|
| 30 |
+
border: 1px dashed rgba(0, 0, 255, 0.5);
|
| 31 |
+
}
|
| 32 |
.page-number {
|
| 33 |
position: absolute;
|
| 34 |
bottom: 5px;
|