@alisaitteke/seatmap-canvas 2.0.3 → 2.3.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/.github/workflows/publish.yml +1 -1
- package/.opencommitignore +2 -1
- package/CHANGELOG.md +2 -0
- package/README.md +3 -5
- package/dist/cjs/index.js +16 -0
- package/examples/index.html +171 -0
- package/package.json +19 -12
- package/rollup.config.js +56 -0
- package/src/lib/canvas.index.ts +2 -3
- package/src/lib/config.ts +1 -1
- package/src/lib/decorators/dom.ts +1 -1
- package/src/lib/decorators/index.ts +1 -1
- package/src/lib/dev.tools.ts +1 -1
- package/src/lib/enums/global.ts +3 -3
- package/src/lib/models/block.model.ts +23 -128
- package/src/lib/models/coordinate.model.ts +3 -20
- package/src/lib/models/data.model.ts +29 -9
- package/src/lib/models/defaults.model.ts +10 -4
- package/src/lib/models/global.model.ts +1 -1
- package/src/lib/models/label.model.ts +5 -38
- package/src/lib/models/legend.model.ts +6 -38
- package/src/lib/models/model.base.ts +5 -22
- package/src/lib/models/seat.model.ts +18 -126
- package/src/lib/svg/event.manager.ts +6 -14
- package/src/lib/svg/legend/legend.circle.ts +1 -1
- package/src/lib/svg/legend/legend.item.ts +7 -4
- package/src/lib/svg/legend/legend.title.ts +2 -2
- package/src/lib/svg/legend.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/block-item.bounds.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/block-item.index.ts +17 -5
- package/src/lib/svg/stage/blocks/block-item/block-item.info.index.ts +2 -1
- package/src/lib/svg/stage/blocks/block-item/block-item.labels.index.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/block-item.mask.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/block-item.seats.index.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/bound/bound-item.index.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/info/title.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/label/label-item.circle.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/label/label-item.index.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/label/label-item.title.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/seat/seat-item.check.ts +12 -5
- package/src/lib/svg/stage/blocks/block-item/seat/seat-item.circle.ts +1 -1
- package/src/lib/svg/stage/blocks/block-item/seat/seat-item.index.ts +4 -4
- package/src/lib/svg/stage/blocks/block-item/seat/seat-item.title.ts +1 -1
- package/src/lib/svg/stage/blocks/blocks.index.ts +8 -5
- package/src/lib/svg/stage/blocks.search-circle.ts +1 -1
- package/src/lib/svg/stage/multi-select/rect.ts +1 -1
- package/src/lib/svg/stage/multi-select.ts +1 -1
- package/src/lib/svg/stage/search-circle/circle.ts +1 -1
- package/src/lib/svg/stage/stage.index.ts +1 -1
- package/src/lib/svg/svg.base.ts +40 -28
- package/src/lib/svg/svg.index.ts +1 -1
- package/src/lib/svg/tooltip/rect.ts +1 -1
- package/src/lib/svg/tooltip/title.ts +2 -11
- package/src/lib/svg/tooltip.ts +4 -3
- package/src/lib/svg/zoom-out.bg.ts +2 -2
- package/src/lib/svg/zoom.manager.ts +56 -48
- package/src/lib/window.manager.ts +3 -3
- package/tsconfig.json +21 -17
- package/dist/seatmap.canvas.2.0.2.css +0 -1
- package/dist/seatmap.canvas.2.0.2.js +0 -2
- package/dist/seatmap.canvas.2.0.2.js.LICENSE.txt +0 -14
- package/examples/basic/bootstrap.min.css +0 -7
- package/examples/basic/index.html +0 -201
- package/examples/basic/jquery.min.js +0 -2
- package/examples/data/data.json +0 -70007
- package/examples/data/small.json +0 -1307
- package/examples/data/tiny.json +0 -119
- package/examples/old/index.html +0 -262
- package/webpack.environments/development.js +0 -58
- package/webpack.environments/production.js +0 -52
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -9,23 +9,19 @@ import ModelBase from "./model.base";
|
|
|
9
9
|
import {SeatItem} from "../svg/stage/blocks/block-item/seat/seat-item.index";
|
|
10
10
|
|
|
11
11
|
export default class SeatModel extends ModelBase {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
private _custom_data: any;
|
|
27
|
-
|
|
28
|
-
private _svg: SeatItem;
|
|
12
|
+
id: any;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
title?: string;
|
|
16
|
+
selected: boolean;
|
|
17
|
+
color: string;
|
|
18
|
+
block: BlockModel;
|
|
19
|
+
salable: boolean;
|
|
20
|
+
note: string;
|
|
21
|
+
tags: Array<string>;
|
|
22
|
+
tag_index: any = {};
|
|
23
|
+
custom_data: any;
|
|
24
|
+
svg: SeatItem | null;
|
|
29
25
|
|
|
30
26
|
// public item_type: string = "Seat";
|
|
31
27
|
|
|
@@ -43,7 +39,8 @@ export default class SeatModel extends ModelBase {
|
|
|
43
39
|
this.selected = item.selected || false;
|
|
44
40
|
this.tags = item.tags || [];
|
|
45
41
|
this.custom_data = item.custom_data || {};
|
|
46
|
-
this.
|
|
42
|
+
this.tag_index = {};
|
|
43
|
+
this.svg = null
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
public selectedToggle(): boolean {
|
|
@@ -51,98 +48,10 @@ export default class SeatModel extends ModelBase {
|
|
|
51
48
|
return this.selected;
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
get x(): number {
|
|
55
|
-
return this._x;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
set x(value: number) {
|
|
59
|
-
this._x = value;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
get y(): number {
|
|
63
|
-
return this._y;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
set y(value: number) {
|
|
67
|
-
this._y = value;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get title(): string {
|
|
71
|
-
return this._title;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
set title(value: string) {
|
|
75
|
-
this._title = value;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
get selected(): boolean {
|
|
79
|
-
return this._selected;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
set selected(value: boolean) {
|
|
83
|
-
this._selected = value;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get color(): string {
|
|
87
|
-
return this._color;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
set color(value: string) {
|
|
91
|
-
this._color = value;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
get block(): BlockModel {
|
|
95
|
-
return this._block;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
set block(value: BlockModel) {
|
|
99
|
-
this._block = value;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
get salable(): boolean {
|
|
103
|
-
return this._salable;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
set salable(value: boolean) {
|
|
107
|
-
this._salable = value;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
get note(): string {
|
|
111
|
-
return this._note;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
set note(value: string) {
|
|
115
|
-
this._note = value;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
get id(): any {
|
|
119
|
-
return this._id;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
set id(value: any) {
|
|
123
|
-
this._id = value;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
get tags(): Array<string> {
|
|
128
|
-
return this._tags;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
set tags(value: Array<string>) {
|
|
132
|
-
this._tags = value;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
get svg(): SeatItem {
|
|
136
|
-
return this._svg;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
set svg(value: SeatItem) {
|
|
140
|
-
this._svg = value;
|
|
141
|
-
}
|
|
142
51
|
|
|
143
52
|
public addTag(tag: string) {
|
|
144
|
-
if (!this.
|
|
145
|
-
this.
|
|
53
|
+
if (!this.tag_index[tag]) {
|
|
54
|
+
this.tag_index[tag] = true;
|
|
146
55
|
this.tags.push(tag);
|
|
147
56
|
}
|
|
148
57
|
}
|
|
@@ -151,23 +60,6 @@ export default class SeatModel extends ModelBase {
|
|
|
151
60
|
|
|
152
61
|
}
|
|
153
62
|
|
|
154
|
-
get tag_index(): any {
|
|
155
|
-
return this._tag_index;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
set tag_index(value: any) {
|
|
159
|
-
this._tag_index = value;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
get custom_data(): any {
|
|
164
|
-
return this._custom_data;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
set custom_data(value: any) {
|
|
168
|
-
this._custom_data = value;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
63
|
public toJson() {
|
|
172
64
|
return {
|
|
173
65
|
id: this.id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {SeatMapCanvas} from "../canvas.index";
|
|
@@ -13,23 +13,23 @@ export interface EventObject {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export default class EventManager {
|
|
16
|
-
|
|
16
|
+
events: Array<EventObject>;
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
constructor(private _self: SeatMapCanvas) {
|
|
20
|
-
this.
|
|
20
|
+
this.events = [];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
addEventListener(type: string | any, fn: any): this {
|
|
24
24
|
if (isArray(type)) {
|
|
25
25
|
for (let i = 0; i < type.length; i++) {
|
|
26
|
-
this.
|
|
26
|
+
this.events.push({
|
|
27
27
|
type: type[i],
|
|
28
28
|
fn: fn
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
} else {
|
|
32
|
-
this.
|
|
32
|
+
this.events.push({
|
|
33
33
|
type: type,
|
|
34
34
|
fn: fn
|
|
35
35
|
});
|
|
@@ -39,18 +39,10 @@ export default class EventManager {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
dispatch(type: string, data: any): this {
|
|
42
|
-
this.
|
|
42
|
+
this.events
|
|
43
43
|
.filter((event: EventObject) => event.type === type)
|
|
44
44
|
.map((event: EventObject) => event.fn(data));
|
|
45
45
|
return this;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
get events(): Array<EventObject> {
|
|
50
|
-
return this._events;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
set events(value: Array<EventObject>) {
|
|
54
|
-
this._events = value;
|
|
55
|
-
}
|
|
56
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -38,10 +38,13 @@ export default class LegendItem extends SvgBase {
|
|
|
38
38
|
|
|
39
39
|
this.title.node.text(this.legend_data.title);
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
if(this.child_index){
|
|
42
|
+
let x = 0;
|
|
43
|
+
let y = this.child_index * this.global.config.legend_style.padding;
|
|
44
|
+
|
|
45
|
+
this.node.attr("transform", "translate(" + [x, y] + ")")
|
|
46
|
+
}
|
|
43
47
|
|
|
44
|
-
this.node.attr("transform", "translate(" + [x, y] + ")")
|
|
45
48
|
|
|
46
49
|
|
|
47
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -15,10 +15,10 @@ import LegendItem from "./legend.item";
|
|
|
15
15
|
})
|
|
16
16
|
export default class LegendTitle extends SvgBase {
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
constructor(public parent: LegendItem) {
|
|
20
19
|
super(parent);
|
|
21
20
|
this.attr("x", this.global.config.legend_style.radius * 1.5);
|
|
21
|
+
this.attr("fill", this.global.config.legend_style.font_color);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
update() {
|
package/src/lib/svg/legend.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {mouse as d3Mouse} from 'd3-selection'
|
|
@@ -45,6 +45,8 @@ export default class Block extends SvgBase {
|
|
|
45
45
|
super(parent);
|
|
46
46
|
this.attr("id", item.id);
|
|
47
47
|
this.attr("opacity", 0);
|
|
48
|
+
|
|
49
|
+
|
|
48
50
|
this.global.eventManager.addEventListener(EventType.ZOOM_LEVEL_CHANGE, (levelObject: any) => {
|
|
49
51
|
if (levelObject.level === ZoomLevel.VENUE) {
|
|
50
52
|
this.mask.blockLevelMask.show();
|
|
@@ -63,10 +65,10 @@ export default class Block extends SvgBase {
|
|
|
63
65
|
}
|
|
64
66
|
});
|
|
65
67
|
|
|
66
|
-
this.global.eventManager.addEventListener(EventType.MULTI_SELECT_ENABLE,()=>{
|
|
68
|
+
this.global.eventManager.addEventListener(EventType.MULTI_SELECT_ENABLE, () => {
|
|
67
69
|
this.seats.resetSeatsColors(false);
|
|
68
70
|
});
|
|
69
|
-
this.global.eventManager.addEventListener(EventType.MULTI_SELECT_DISABLE,()=>{
|
|
71
|
+
this.global.eventManager.addEventListener(EventType.MULTI_SELECT_DISABLE, () => {
|
|
70
72
|
this.seats.resetSeatsColors(false);
|
|
71
73
|
});
|
|
72
74
|
|
|
@@ -83,8 +85,6 @@ export default class Block extends SvgBase {
|
|
|
83
85
|
for (let i = 0; i < block_item.seats.getSeatsCount(); i++) {
|
|
84
86
|
let _seat = block_item.seats.getSeatByIndex(i);
|
|
85
87
|
let _item: SeatModel = _seat.item;
|
|
86
|
-
|
|
87
|
-
|
|
88
88
|
let color = _seat.getColor();
|
|
89
89
|
if (_seat.isSelected()) {
|
|
90
90
|
color = _seat.getColor(SeatAction.SELECT);
|
|
@@ -100,6 +100,12 @@ export default class Block extends SvgBase {
|
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
+
this.global.eventManager.addEventListener(EventType.MOUSELEAVE_BLOCK, (block_item: Block) => {
|
|
104
|
+
console.log(block_item)
|
|
105
|
+
this.seats.resetSeatsColors()
|
|
106
|
+
|
|
107
|
+
})
|
|
108
|
+
|
|
103
109
|
// grid search
|
|
104
110
|
// this.global.eventManager.addEventListener(EventType.TOUCHSTART_BLOCK, (block_item: Block) => {
|
|
105
111
|
// console.log(block_item);
|
|
@@ -152,8 +158,14 @@ export default class Block extends SvgBase {
|
|
|
152
158
|
|
|
153
159
|
this.infosToCenter();
|
|
154
160
|
|
|
161
|
+
|
|
155
162
|
this.node.interrupt().transition().duration(this.global.config.animation_speed).attr("opacity", 1);
|
|
156
163
|
|
|
164
|
+
if (this.item.rotate) {
|
|
165
|
+
this.node.attr("transform-origin", `${this.center_position.x} ${this.center_position.y}`);
|
|
166
|
+
this.node.attr("transform", 'rotate(' + this.item.rotate + ')');
|
|
167
|
+
}
|
|
168
|
+
|
|
157
169
|
|
|
158
170
|
return this;
|
|
159
171
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import SvgBase from "../../../svg.base";
|
|
@@ -21,6 +21,7 @@ export default class BlockInfo extends SvgBase {
|
|
|
21
21
|
|
|
22
22
|
constructor(public parent: Block, public item: BlockModel) {
|
|
23
23
|
super(parent);
|
|
24
|
+
console.log('item',item)
|
|
24
25
|
this.attr("opacity", 0);
|
|
25
26
|
let x = ((this.item.bounds[1][0] - this.item.bounds[2][0]) / 2) + this.item.bounds[2][0];
|
|
26
27
|
let y = ((this.item.bounds[0][1] - this.item.bounds[1][1]) / 2) + this.item.bounds[1][1];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import SvgBase from "../../../../svg.base";
|
|
@@ -8,7 +8,7 @@ import {dom} from "../../../../../decorators/dom";
|
|
|
8
8
|
import {SeatItem} from "./seat-item.index";
|
|
9
9
|
|
|
10
10
|
@dom({
|
|
11
|
-
tag: "
|
|
11
|
+
tag: "text",
|
|
12
12
|
class: "seat-check",
|
|
13
13
|
autoGenerate: false
|
|
14
14
|
})
|
|
@@ -16,11 +16,16 @@ export class SeatItemCheck extends SvgBase {
|
|
|
16
16
|
|
|
17
17
|
constructor(public parent: SeatItem) {
|
|
18
18
|
super(parent);
|
|
19
|
-
this.attr("d", "M12.9,953.7l-6.3,6.5l-2.9-2.5l-2.1,2.4l4.1,3.5l1.1,1l1.1-1.1l7.3-7.6L12.9,953.7L12.9,953.7z");
|
|
20
|
-
this.
|
|
21
|
-
this.attr("
|
|
19
|
+
// this.attr("d", "M12.9,953.7l-6.3,6.5l-2.9-2.5l-2.1,2.4l4.1,3.5l1.1,1l1.1-1.1l7.3-7.6L12.9,953.7L12.9,953.7z");
|
|
20
|
+
this.text('\uf005')
|
|
21
|
+
this.attr("class", 'fa');
|
|
22
|
+
// this.attr("fill", '#ff0000');
|
|
23
|
+
|
|
24
|
+
this.attr("fill", this.global.config.seat_style.check_icon_color);
|
|
25
|
+
this.attr("transform", "translate(-7,4) scale(0.8)");
|
|
22
26
|
this.attr("pointer-events", "none");
|
|
23
27
|
this.attr("display", "none");
|
|
28
|
+
this.attr("opacity", 0);
|
|
24
29
|
|
|
25
30
|
return this;
|
|
26
31
|
}
|
|
@@ -35,11 +40,13 @@ export class SeatItemCheck extends SvgBase {
|
|
|
35
40
|
|
|
36
41
|
show():this {
|
|
37
42
|
this.node.attr("display", "block");
|
|
43
|
+
this.node.attr("opacity", 1);
|
|
38
44
|
return this;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
hide():this {
|
|
42
48
|
this.node.attr("display", "none");
|
|
49
|
+
this.node.attr("opacity", 0);
|
|
43
50
|
return this;
|
|
44
51
|
}
|
|
45
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2018 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -45,12 +45,12 @@ export class SeatItem extends SvgBase {
|
|
|
45
45
|
return this;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
public updateColor(color: string = null): this {
|
|
48
|
+
public updateColor(color: string | null = null): this {
|
|
49
49
|
this.setColor(this.getColor());
|
|
50
50
|
return this;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
public select(color: string = null): this {
|
|
53
|
+
public select(color: string | null = null): this {
|
|
54
54
|
this.item.selected = true;
|
|
55
55
|
this.node.classed("selected", true);
|
|
56
56
|
this.circle.node.attr("fill", this.global.config.seat_style.selected);
|
|
@@ -82,7 +82,7 @@ export class SeatItem extends SvgBase {
|
|
|
82
82
|
this.setColor(this.getColor());
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
public getColor(action: SeatAction = null): string {
|
|
85
|
+
public getColor(action: SeatAction| null = null): string {
|
|
86
86
|
|
|
87
87
|
if (this.isSalable()) {
|
|
88
88
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* blocks.ts
|
|
3
|
-
* https://github.com/seatmap
|
|
3
|
+
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {polygonHull} from 'd3-polygon'
|
|
@@ -43,8 +43,7 @@ export default class Blocks extends SvgBase {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
let bound_items: Array<any> = _seats.map((item: SeatModel) => [item.x, item.y]).concat(block_item.labels.map((item: LabelModel) => [item.x, item.y]));
|
|
46
|
-
|
|
47
|
-
block_item.bounds = _bounds;
|
|
46
|
+
block_item.bounds = polygonHull(bound_items);
|
|
48
47
|
|
|
49
48
|
this.addChild(_blockItem);
|
|
50
49
|
});
|
|
@@ -54,8 +53,12 @@ export default class Blocks extends SvgBase {
|
|
|
54
53
|
return this;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
public getBlock(id: any): Block {
|
|
58
|
-
|
|
56
|
+
public getBlock(id: any): Block | null {
|
|
57
|
+
const block = this.getBlocks().find((block: Block) => block.item.id == id)
|
|
58
|
+
if (block)
|
|
59
|
+
return block;
|
|
60
|
+
else
|
|
61
|
+
return null;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
public getBlocks(): Array<Block> {
|