@alisaitteke/seatmap-canvas 2.6.1 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +146 -1
- package/dist/cjs/seatmap.canvas.js +2 -2
- package/dist/cjs/seatmap.canvas.js.map +1 -1
- package/dist/cjs/types/models/block.model.d.ts +7 -0
- package/dist/cjs/types/models/defaults.model.d.ts +7 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/block-item.background.d.ts +14 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/block-item.index.d.ts +2 -0
- package/dist/cjs/types/svg/stage/stage.background.d.ts +10 -0
- package/dist/cjs/types/svg/stage/stage.index.d.ts +2 -0
- package/dist/esm/seatmap.canvas.js +2 -2
- package/dist/esm/seatmap.canvas.js.map +1 -1
- package/dist/esm/types/models/block.model.d.ts +7 -0
- package/dist/esm/types/models/defaults.model.d.ts +7 -0
- package/dist/esm/types/svg/stage/blocks/block-item/block-item.background.d.ts +14 -0
- package/dist/esm/types/svg/stage/blocks/block-item/block-item.index.d.ts +2 -0
- package/dist/esm/types/svg/stage/stage.background.d.ts +10 -0
- package/dist/esm/types/svg/stage/stage.index.d.ts +2 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -3,10 +3,13 @@ Seatmap Canvas is an advanced, open-source library for interactive seat selectio
|
|
|
3
3
|
|
|
4
4
|
[](https://alisaitteke.github.io/seatmap-canvas)
|
|
5
5
|
|
|
6
|
+
**[📖 Documentation](https://alisaitteke.github.io/seatmap-canvas/docs)** | **[🎯 Live Demo](https://alisaitteke.github.io/seatmap-canvas)**
|
|
7
|
+
|
|
6
8
|
## Features
|
|
7
9
|
|
|
8
10
|
- **Framework Agnostic** - Core library works with vanilla JS, plus official React and Vue 3 wrappers
|
|
9
11
|
- **Dynamic Seat Selection** - Interactive selection, categorization, and location of seats
|
|
12
|
+
- **Custom Background Images** - Global and per-block background images with positioning control
|
|
10
13
|
- **Customizable Styles** - Extensive styling options for seats, blocks, and labels
|
|
11
14
|
- **Interactive Seat Models** - Define properties like salability, notes, colors, and custom data
|
|
12
15
|
- **Block Organization** - Organize seats into blocks with titles, colors, and labels
|
|
@@ -330,10 +333,145 @@ const selected = seatmap.getSelectedSeats();
|
|
|
330
333
|
#### Configuration Options
|
|
331
334
|
```js
|
|
332
335
|
{
|
|
333
|
-
click_enable_sold_seats: true // Enable clicking on unavailable seats (default: false)
|
|
336
|
+
click_enable_sold_seats: true, // Enable clicking on unavailable seats (default: false)
|
|
337
|
+
|
|
338
|
+
// Global Background Image
|
|
339
|
+
background_image: "assets/stadium.jpg", // Image URL (PNG, JPG, SVG, WebP, GIF)
|
|
340
|
+
background_opacity: 0.3, // 0-1 (default: 0.3)
|
|
341
|
+
background_fit: "cover", // "cover" | "contain" | "fill" | "none"
|
|
342
|
+
background_x: 0, // Manual X position (optional, auto-detect if null)
|
|
343
|
+
background_y: 0, // Manual Y position (optional)
|
|
344
|
+
background_width: 1500, // Manual width (optional)
|
|
345
|
+
background_height: 1000 // Manual height (optional)
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
</details>
|
|
350
|
+
|
|
351
|
+
<details>
|
|
352
|
+
<summary><strong>🖼️ Custom Background Images</strong></summary>
|
|
353
|
+
|
|
354
|
+
#### Global Background
|
|
355
|
+
|
|
356
|
+
Add a background image to the entire stage:
|
|
357
|
+
|
|
358
|
+
```javascript
|
|
359
|
+
const seatmap = new SeatmapCanvas(".container", {
|
|
360
|
+
background_image: "assets/concert-hall.jpg",
|
|
361
|
+
background_opacity: 0.3,
|
|
362
|
+
background_fit: "cover"
|
|
363
|
+
});
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**With Manual Positioning:**
|
|
367
|
+
```javascript
|
|
368
|
+
const seatmap = new SeatmapCanvas(".container", {
|
|
369
|
+
background_image: "assets/stadium.jpg",
|
|
370
|
+
background_x: -500, // Position X
|
|
371
|
+
background_y: -500, // Position Y
|
|
372
|
+
background_width: 3000, // Width
|
|
373
|
+
background_height: 2500, // Height
|
|
374
|
+
background_opacity: 0.4,
|
|
375
|
+
background_fit: "contain" // Preserve aspect ratio
|
|
376
|
+
});
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
#### Block-Level Background
|
|
380
|
+
|
|
381
|
+
Add custom backgrounds to individual blocks:
|
|
382
|
+
|
|
383
|
+
```javascript
|
|
384
|
+
{
|
|
385
|
+
blocks: [{
|
|
386
|
+
id: "vip-section",
|
|
387
|
+
title: "VIP Area",
|
|
388
|
+
background_image: "assets/vip-lounge.jpg",
|
|
389
|
+
background_opacity: 0.6,
|
|
390
|
+
background_fit: "cover",
|
|
391
|
+
seats: [...]
|
|
392
|
+
}, {
|
|
393
|
+
id: "general",
|
|
394
|
+
title: "General Admission",
|
|
395
|
+
background_image: "assets/general-area.jpg",
|
|
396
|
+
background_opacity: 0.5,
|
|
397
|
+
seats: [...]
|
|
398
|
+
}]
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**With Manual Positioning:**
|
|
403
|
+
```javascript
|
|
404
|
+
{
|
|
405
|
+
blocks: [{
|
|
406
|
+
id: "block-a",
|
|
407
|
+
background_image: "section-a.jpg",
|
|
408
|
+
background_x: 100, // Exact X coordinate
|
|
409
|
+
background_y: 200, // Exact Y coordinate
|
|
410
|
+
background_width: 500, // Exact width
|
|
411
|
+
background_height: 400, // Exact height
|
|
412
|
+
background_opacity: 0.7,
|
|
413
|
+
background_fit: "cover",
|
|
414
|
+
seats: [...]
|
|
415
|
+
}]
|
|
334
416
|
}
|
|
335
417
|
```
|
|
336
418
|
|
|
419
|
+
#### Fit Modes
|
|
420
|
+
|
|
421
|
+
- **`cover`** (default) - Image covers entire area, may crop
|
|
422
|
+
- **`contain`** - Image fits inside area, preserves aspect ratio
|
|
423
|
+
- **`fill`** - Image stretches to fill area
|
|
424
|
+
- **`none`** - Image keeps original size, centered
|
|
425
|
+
|
|
426
|
+
#### Features
|
|
427
|
+
|
|
428
|
+
- ✅ **Auto-Detection:** X, Y, Width, Height auto-calculated from bounds if not specified
|
|
429
|
+
- ✅ **Clip-Path Masking:** Block backgrounds clipped to exact block shape
|
|
430
|
+
- ✅ **Opacity Control:** Adjustable transparency (0-1)
|
|
431
|
+
- ✅ **Auto-Hide Bounds:** Block borders/fills hidden when background exists
|
|
432
|
+
- ✅ **Zoom Preserved:** Bounds calculations still work for zoom levels
|
|
433
|
+
- ✅ **Format Support:** PNG, JPG, SVG, WebP, GIF, all web-compatible formats
|
|
434
|
+
- ✅ **Performance:** Browser-native image loading and caching
|
|
435
|
+
|
|
436
|
+
#### Use Cases
|
|
437
|
+
|
|
438
|
+
**Stadium/Arena:**
|
|
439
|
+
```javascript
|
|
440
|
+
// Stadium overview as background
|
|
441
|
+
background_image: "stadium-aerial.jpg"
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
**Theater:**
|
|
445
|
+
```javascript
|
|
446
|
+
// Stage photo per seating section
|
|
447
|
+
blocks: [
|
|
448
|
+
{ id: "orchestra", background_image: "orchestra-view.jpg" },
|
|
449
|
+
{ id: "balcony", background_image: "balcony-view.jpg" }
|
|
450
|
+
]
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
**Restaurant:**
|
|
454
|
+
```javascript
|
|
455
|
+
// Floor plan as background
|
|
456
|
+
background_image: "floor-plan.png",
|
|
457
|
+
background_opacity: 0.5,
|
|
458
|
+
background_fit: "contain"
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
**Event Space:**
|
|
462
|
+
```javascript
|
|
463
|
+
// Custom venue layout
|
|
464
|
+
background_image: "venue-layout.svg",
|
|
465
|
+
background_fit: "contain"
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
#### Important Notes
|
|
469
|
+
|
|
470
|
+
- Background images don't affect zoom calculations (bounds preserved)
|
|
471
|
+
- Block borders/fills automatically hidden when background assigned
|
|
472
|
+
- CORS: Images must be same-origin or CORS-enabled
|
|
473
|
+
- Performance: Use optimized images (< 500KB recommended)
|
|
474
|
+
|
|
337
475
|
</details>
|
|
338
476
|
|
|
339
477
|
<details>
|
|
@@ -426,6 +564,13 @@ seatmap.setData(data);
|
|
|
426
564
|
|
|
427
565
|
---
|
|
428
566
|
|
|
567
|
+
## Links
|
|
568
|
+
|
|
569
|
+
- 📖 [Documentation](https://alisaitteke.github.io/seatmap-canvas/docs)
|
|
570
|
+
- 🎯 [Live Demo](https://alisaitteke.github.io/seatmap-canvas)
|
|
571
|
+
- 📦 [NPM Package](https://www.npmjs.com/package/@alisaitteke/seatmap-canvas)
|
|
572
|
+
- 🐛 [Report Issues](https://github.com/alisaitteke/seatmap-canvas/issues)
|
|
573
|
+
|
|
429
574
|
## Contributors
|
|
430
575
|
|
|
431
576
|
<a href="https://github.com/alisaitteke">
|