@alisaitteke/seatmap-canvas 2.3.0 → 2.4.1

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.
Files changed (194) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE +1 -1
  3. package/README.md +15 -5
  4. package/dist/cjs/seatmap.canvas.css +151 -0
  5. package/dist/cjs/seatmap.canvas.js +40 -0
  6. package/dist/cjs/seatmap.canvas.js.map +1 -0
  7. package/dist/cjs/types/canvas.index.browser.d.ts +2 -0
  8. package/dist/cjs/types/canvas.index.d.ts +23 -0
  9. package/dist/cjs/types/config.d.ts +3 -0
  10. package/dist/cjs/types/decorators/dom.d.ts +8 -0
  11. package/dist/cjs/types/decorators/index.d.ts +1 -0
  12. package/dist/cjs/types/dev.tools.d.ts +6 -0
  13. package/{src/lib/enums/global.ts → dist/cjs/types/enums/global.d.ts} +4 -25
  14. package/dist/cjs/types/models/block.model.d.ts +29 -0
  15. package/dist/cjs/types/models/coordinate.model.d.ts +7 -0
  16. package/dist/cjs/types/models/data.model.d.ts +26 -0
  17. package/dist/cjs/types/models/defaults.model.d.ts +32 -0
  18. package/dist/cjs/types/models/global.model.d.ts +18 -0
  19. package/dist/cjs/types/models/label.model.d.ts +9 -0
  20. package/dist/cjs/types/models/legend.model.d.ts +8 -0
  21. package/dist/cjs/types/models/model.base.d.ts +5 -0
  22. package/dist/cjs/types/models/seat.model.d.ts +40 -0
  23. package/dist/cjs/types/models/styles/block.style.d.ts +7 -0
  24. package/dist/cjs/types/models/styles/label.style.d.ts +6 -0
  25. package/dist/cjs/types/models/styles/legend.style.d.ts +6 -0
  26. package/dist/cjs/types/models/styles/seat.style.d.ts +12 -0
  27. package/dist/cjs/types/models/styles/tooltip.style.d.ts +7 -0
  28. package/dist/cjs/types/svg/event.manager.d.ts +12 -0
  29. package/dist/cjs/types/svg/legend/legend.circle.d.ts +7 -0
  30. package/dist/cjs/types/svg/legend/legend.item.d.ts +13 -0
  31. package/dist/cjs/types/svg/legend/legend.title.d.ts +7 -0
  32. package/dist/cjs/types/svg/legend.d.ts +8 -0
  33. package/dist/cjs/types/svg/stage/blocks/block-item/block-item.bounds.d.ts +12 -0
  34. package/dist/cjs/types/svg/stage/blocks/block-item/block-item.index.d.ts +23 -0
  35. package/dist/cjs/types/svg/stage/blocks/block-item/block-item.info.index.d.ts +11 -0
  36. package/dist/cjs/types/svg/stage/blocks/block-item/block-item.labels.index.d.ts +11 -0
  37. package/dist/cjs/types/svg/stage/blocks/block-item/block-item.mask.d.ts +12 -0
  38. package/dist/cjs/types/svg/stage/blocks/block-item/block-item.seats.index.d.ts +15 -0
  39. package/dist/cjs/types/svg/stage/blocks/block-item/bound/bound-item.index.d.ts +12 -0
  40. package/dist/cjs/types/svg/stage/blocks/block-item/info/title.d.ts +7 -0
  41. package/dist/cjs/types/svg/stage/blocks/block-item/label/label-item.circle.d.ts +7 -0
  42. package/dist/cjs/types/svg/stage/blocks/block-item/label/label-item.index.d.ts +13 -0
  43. package/dist/cjs/types/svg/stage/blocks/block-item/label/label-item.title.d.ts +7 -0
  44. package/dist/cjs/types/svg/stage/blocks/block-item/seat/seat-item.check.d.ts +10 -0
  45. package/dist/cjs/types/svg/stage/blocks/block-item/seat/seat-item.circle.d.ts +7 -0
  46. package/dist/cjs/types/svg/stage/blocks/block-item/seat/seat-item.index.d.ts +28 -0
  47. package/dist/cjs/types/svg/stage/blocks/block-item/seat/seat-item.title.d.ts +7 -0
  48. package/dist/cjs/types/svg/stage/blocks/blocks.index.d.ts +13 -0
  49. package/dist/cjs/types/svg/stage/blocks.search-circle.d.ts +12 -0
  50. package/dist/cjs/types/svg/stage/multi-select/rect.d.ts +7 -0
  51. package/dist/cjs/types/svg/stage/multi-select.d.ts +13 -0
  52. package/dist/cjs/types/svg/stage/search-circle/circle.d.ts +7 -0
  53. package/dist/cjs/types/svg/stage/stage.index.d.ts +11 -0
  54. package/dist/cjs/types/svg/svg.base.d.ts +35 -0
  55. package/dist/cjs/types/svg/svg.index.d.ts +16 -0
  56. package/dist/cjs/types/svg/tooltip/rect.d.ts +8 -0
  57. package/dist/cjs/types/svg/tooltip/title.d.ts +10 -0
  58. package/dist/cjs/types/svg/tooltip.d.ts +15 -0
  59. package/dist/cjs/types/svg/zoom-out.bg.d.ts +7 -0
  60. package/dist/cjs/types/svg/zoom.manager.d.ts +41 -0
  61. package/dist/cjs/types/window.manager.d.ts +9 -0
  62. package/dist/dependencies.txt +849 -0
  63. package/dist/esm/seatmap.canvas.css +151 -0
  64. package/dist/esm/seatmap.canvas.js +16 -0
  65. package/dist/esm/seatmap.canvas.js.map +1 -0
  66. package/dist/esm/types/canvas.index.browser.d.ts +2 -0
  67. package/dist/esm/types/canvas.index.d.ts +23 -0
  68. package/dist/esm/types/config.d.ts +3 -0
  69. package/dist/esm/types/decorators/dom.d.ts +8 -0
  70. package/dist/esm/types/decorators/index.d.ts +1 -0
  71. package/dist/esm/types/dev.tools.d.ts +6 -0
  72. package/dist/esm/types/enums/global.d.ts +46 -0
  73. package/dist/esm/types/models/block.model.d.ts +29 -0
  74. package/dist/esm/types/models/coordinate.model.d.ts +7 -0
  75. package/dist/esm/types/models/data.model.d.ts +26 -0
  76. package/dist/esm/types/models/defaults.model.d.ts +32 -0
  77. package/dist/esm/types/models/global.model.d.ts +18 -0
  78. package/dist/esm/types/models/label.model.d.ts +9 -0
  79. package/dist/esm/types/models/legend.model.d.ts +8 -0
  80. package/dist/esm/types/models/model.base.d.ts +5 -0
  81. package/dist/esm/types/models/seat.model.d.ts +40 -0
  82. package/dist/esm/types/models/styles/block.style.d.ts +7 -0
  83. package/dist/esm/types/models/styles/label.style.d.ts +6 -0
  84. package/dist/esm/types/models/styles/legend.style.d.ts +6 -0
  85. package/dist/esm/types/models/styles/seat.style.d.ts +12 -0
  86. package/dist/esm/types/models/styles/tooltip.style.d.ts +7 -0
  87. package/dist/esm/types/svg/event.manager.d.ts +12 -0
  88. package/dist/esm/types/svg/legend/legend.circle.d.ts +7 -0
  89. package/dist/esm/types/svg/legend/legend.item.d.ts +13 -0
  90. package/dist/esm/types/svg/legend/legend.title.d.ts +7 -0
  91. package/dist/esm/types/svg/legend.d.ts +8 -0
  92. package/dist/esm/types/svg/stage/blocks/block-item/block-item.bounds.d.ts +12 -0
  93. package/dist/esm/types/svg/stage/blocks/block-item/block-item.index.d.ts +23 -0
  94. package/dist/esm/types/svg/stage/blocks/block-item/block-item.info.index.d.ts +11 -0
  95. package/dist/esm/types/svg/stage/blocks/block-item/block-item.labels.index.d.ts +11 -0
  96. package/dist/esm/types/svg/stage/blocks/block-item/block-item.mask.d.ts +12 -0
  97. package/dist/esm/types/svg/stage/blocks/block-item/block-item.seats.index.d.ts +15 -0
  98. package/dist/esm/types/svg/stage/blocks/block-item/bound/bound-item.index.d.ts +12 -0
  99. package/dist/esm/types/svg/stage/blocks/block-item/info/title.d.ts +7 -0
  100. package/dist/esm/types/svg/stage/blocks/block-item/label/label-item.circle.d.ts +7 -0
  101. package/dist/esm/types/svg/stage/blocks/block-item/label/label-item.index.d.ts +13 -0
  102. package/dist/esm/types/svg/stage/blocks/block-item/label/label-item.title.d.ts +7 -0
  103. package/dist/esm/types/svg/stage/blocks/block-item/seat/seat-item.check.d.ts +10 -0
  104. package/dist/esm/types/svg/stage/blocks/block-item/seat/seat-item.circle.d.ts +7 -0
  105. package/dist/esm/types/svg/stage/blocks/block-item/seat/seat-item.index.d.ts +28 -0
  106. package/dist/esm/types/svg/stage/blocks/block-item/seat/seat-item.title.d.ts +7 -0
  107. package/dist/esm/types/svg/stage/blocks/blocks.index.d.ts +13 -0
  108. package/dist/esm/types/svg/stage/blocks.search-circle.d.ts +12 -0
  109. package/dist/esm/types/svg/stage/multi-select/rect.d.ts +7 -0
  110. package/dist/esm/types/svg/stage/multi-select.d.ts +13 -0
  111. package/dist/esm/types/svg/stage/search-circle/circle.d.ts +7 -0
  112. package/dist/esm/types/svg/stage/stage.index.d.ts +11 -0
  113. package/dist/esm/types/svg/svg.base.d.ts +35 -0
  114. package/dist/esm/types/svg/svg.index.d.ts +16 -0
  115. package/dist/esm/types/svg/tooltip/rect.d.ts +8 -0
  116. package/dist/esm/types/svg/tooltip/title.d.ts +10 -0
  117. package/dist/esm/types/svg/tooltip.d.ts +15 -0
  118. package/dist/esm/types/svg/zoom-out.bg.d.ts +7 -0
  119. package/dist/esm/types/svg/zoom.manager.d.ts +41 -0
  120. package/dist/esm/types/window.manager.d.ts +9 -0
  121. package/dist/types.d.ts +533 -0
  122. package/package.json +9 -13
  123. package/.eslintrc.json +0 -15
  124. package/.github/FUNDING.yml +0 -4
  125. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  126. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  127. package/.github/workflows/codeql-analysis.yml +0 -29
  128. package/.github/workflows/npm-publish-packages.yml +0 -35
  129. package/.github/workflows/publish.yml +0 -106
  130. package/.github/workflows/webpack.yml +0 -22
  131. package/.opencommitignore +0 -2
  132. package/AUTHORS +0 -3
  133. package/SECURITY.md +0 -21
  134. package/_config.yml +0 -1
  135. package/assets/banner_ui.png +0 -0
  136. package/assets/bn.jpg +0 -0
  137. package/assets/logo.jpg +0 -0
  138. package/assets/logo_small.jpg +0 -0
  139. package/assets/zoom_out.svg +0 -11
  140. package/cog.toml +0 -19
  141. package/dist/cjs/index.js +0 -16
  142. package/examples/index.html +0 -171
  143. package/rollup.config.js +0 -56
  144. package/src/lib/canvas.index.ts +0 -121
  145. package/src/lib/config.ts +0 -11
  146. package/src/lib/decorators/dom.ts +0 -40
  147. package/src/lib/decorators/index.ts +0 -6
  148. package/src/lib/dev.tools.ts +0 -18
  149. package/src/lib/models/block.model.ts +0 -65
  150. package/src/lib/models/coordinate.model.ts +0 -26
  151. package/src/lib/models/data.model.ts +0 -125
  152. package/src/lib/models/defaults.model.ts +0 -131
  153. package/src/lib/models/global.model.ts +0 -24
  154. package/src/lib/models/label.model.ts +0 -25
  155. package/src/lib/models/legend.model.ts +0 -24
  156. package/src/lib/models/model.base.ts +0 -15
  157. package/src/lib/models/seat.model.ts +0 -74
  158. package/src/lib/svg/event.manager.ts +0 -48
  159. package/src/lib/svg/legend/legend.circle.ts +0 -28
  160. package/src/lib/svg/legend/legend.item.ts +0 -53
  161. package/src/lib/svg/legend/legend.title.ts +0 -27
  162. package/src/lib/svg/legend.ts +0 -55
  163. package/src/lib/svg/stage/blocks/block-item/block-item.bounds.ts +0 -51
  164. package/src/lib/svg/stage/blocks/block-item/block-item.index.ts +0 -185
  165. package/src/lib/svg/stage/blocks/block-item/block-item.info.index.ts +0 -39
  166. package/src/lib/svg/stage/blocks/block-item/block-item.labels.index.ts +0 -41
  167. package/src/lib/svg/stage/blocks/block-item/block-item.mask.ts +0 -67
  168. package/src/lib/svg/stage/blocks/block-item/block-item.seats.index.ts +0 -81
  169. package/src/lib/svg/stage/blocks/block-item/bound/bound-item.index.ts +0 -43
  170. package/src/lib/svg/stage/blocks/block-item/info/title.ts +0 -30
  171. package/src/lib/svg/stage/blocks/block-item/label/label-item.circle.ts +0 -27
  172. package/src/lib/svg/stage/blocks/block-item/label/label-item.index.ts +0 -46
  173. package/src/lib/svg/stage/blocks/block-item/label/label-item.title.ts +0 -27
  174. package/src/lib/svg/stage/blocks/block-item/seat/seat-item.check.ts +0 -52
  175. package/src/lib/svg/stage/blocks/block-item/seat/seat-item.circle.ts +0 -30
  176. package/src/lib/svg/stage/blocks/block-item/seat/seat-item.index.ts +0 -159
  177. package/src/lib/svg/stage/blocks/block-item/seat/seat-item.title.ts +0 -27
  178. package/src/lib/svg/stage/blocks/blocks.index.ts +0 -71
  179. package/src/lib/svg/stage/blocks.search-circle.ts +0 -86
  180. package/src/lib/svg/stage/multi-select/rect.ts +0 -36
  181. package/src/lib/svg/stage/multi-select.ts +0 -107
  182. package/src/lib/svg/stage/search-circle/circle.ts +0 -37
  183. package/src/lib/svg/stage/stage.index.ts +0 -41
  184. package/src/lib/svg/svg.base.ts +0 -229
  185. package/src/lib/svg/svg.index.ts +0 -76
  186. package/src/lib/svg/tooltip/rect.ts +0 -66
  187. package/src/lib/svg/tooltip/title.ts +0 -48
  188. package/src/lib/svg/tooltip.ts +0 -93
  189. package/src/lib/svg/zoom-out.bg.ts +0 -35
  190. package/src/lib/svg/zoom.manager.ts +0 -448
  191. package/src/lib/window.manager.ts +0 -40
  192. package/src/scss/lib.scss +0 -10
  193. package/src/scss/style.scss +0 -221
  194. package/tsconfig.json +0 -32
@@ -1,53 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
-
7
- import {dom} from "../../decorators";
8
- import SvgBase from "./../svg.base";
9
- import Legend from "../legend";
10
- import LegendCircle from "./legend.circle";
11
- import LegendTitle from "./legend.title";
12
- import LegendModel from "../../models/legend.model";
13
-
14
- @dom({
15
- tag: "g",
16
- class: "legend-item",
17
- autoGenerate: false
18
- })
19
- export default class LegendItem extends SvgBase {
20
-
21
- public circle: LegendCircle;
22
- public title: LegendTitle;
23
-
24
- constructor(public parent: Legend, public legend_data: LegendModel) {
25
- super(parent);
26
-
27
- }
28
-
29
- update() {
30
-
31
- this.circle = new LegendCircle(this);
32
- this.addChild(this.circle);
33
-
34
- this.title = new LegendTitle(this);
35
- this.addChild(this.title);
36
-
37
- this.updateChilds();
38
-
39
- this.title.node.text(this.legend_data.title);
40
-
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
- }
47
-
48
-
49
-
50
- }
51
-
52
-
53
- }
@@ -1,27 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
-
7
- import {dom} from "../../decorators";
8
- import SvgBase from "./../svg.base";
9
- import LegendItem from "./legend.item";
10
-
11
- @dom({
12
- tag: "text",
13
- class: "legend-title",
14
- autoGenerate: false
15
- })
16
- export default class LegendTitle extends SvgBase {
17
-
18
- constructor(public parent: LegendItem) {
19
- super(parent);
20
- this.attr("x", this.global.config.legend_style.radius * 1.5);
21
- this.attr("fill", this.global.config.legend_style.font_color);
22
- }
23
-
24
- update() {
25
-
26
- }
27
- }
@@ -1,55 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
-
7
- import {dom} from "../decorators";
8
- import SvgBase from "./svg.base";
9
- import Svg from "./svg.index";
10
- import LegendItem from "./legend/legend.item";
11
-
12
- @dom({
13
- tag: "g",
14
- class: "legend",
15
- autoGenerate: false
16
- })
17
- export default class Legend extends SvgBase {
18
-
19
-
20
- constructor(public parent: Svg) {
21
- super(parent);
22
- }
23
-
24
- update() {
25
-
26
- let legend_data: Array<any> = [];
27
-
28
- legend_data.push({
29
- title: this.global.config.lang.non_selectable,
30
- color: this.global.config.seat_style.not_salable
31
- });
32
- legend_data.push({
33
- title: this.global.config.lang.selectable,
34
- color: this.global.config.seat_style.color
35
- });
36
- legend_data.push({
37
- title: this.global.config.lang.your_selection,
38
- color: this.global.config.seat_style.selected
39
- });
40
-
41
- for (let i = 0; i < legend_data.length; i++) {
42
- let legend: LegendItem = new LegendItem(this, legend_data[i]);
43
- this.addChild(legend);
44
- }
45
-
46
- this.updateChilds()
47
- }
48
-
49
- afterGenerate() {
50
-
51
- let x = this.global.config.legend_style.radius * 2;
52
- let y = 150 - (this.global.config.legend_style.padding * this.getChildCount());
53
- this.node.attr("transform", "translate(" + [x, y] + ")");
54
- }
55
- }
@@ -1,51 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
- import SvgBase from "../../../svg.base";
7
- import {dom} from "../../../../decorators/dom";
8
- import BlockModel from "../../../../models/block.model";
9
- import Block from "./block-item.index";
10
- import {BoundItem} from "./bound/bound-item.index";
11
-
12
- @dom({
13
- tag: "g",
14
- class: "bounds",
15
- autoGenerate: false
16
- })
17
- export default class BlockBounds extends SvgBase {
18
-
19
- public bound1: BoundItem;
20
- public bound2: BoundItem;
21
-
22
- constructor(public parent: Block, public item: BlockModel) {
23
- super(parent);
24
- return this;
25
- }
26
-
27
- update(): this {
28
-
29
- // add Border Bounds container
30
- this.bound1 = new BoundItem(this, this.item);
31
- this.bound1.attr("fill", this.parent.item.border_color);
32
- this.bound1.attr("stroke-width", 70);
33
- this.bound1.attr("stroke", this.parent.item.border_color);
34
- this.bound1.classed("block-hull-border");
35
-
36
- // add Border Bounds container
37
- this.bound2 = new BoundItem(this, this.item);
38
- this.bound2.attr("fill", this.item.color);
39
- this.bound2.attr("stroke-width", 60);
40
- this.bound2.attr("stroke", this.item.color);
41
- this.bound2.classed("block-hull");
42
-
43
-
44
- this.addChild(this.bound1);
45
- this.addChild(this.bound2);
46
-
47
- this.updateChilds();
48
-
49
- return this;
50
- }
51
- }
@@ -1,185 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
- import {mouse as d3Mouse} from 'd3-selection'
7
-
8
- import BlocksManager from "../blocks.index";
9
- import SvgBase from "../../../svg.base";
10
- import {dom} from "../../../../decorators/dom";
11
- import BlockModel from "../../../../models/block.model";
12
- import Seats from "./block-item.seats.index";
13
- import BlockInfo from "./block-item.info.index";
14
- import BlockBounds from "./block-item.bounds";
15
- import {EventType, SeatAction, ZoomLevel} from "../../../../enums/global";
16
- import BlockMask from "./block-item.mask";
17
- import Labels from "./block-item.labels.index";
18
- import SeatModel from "../../../../models/seat.model";
19
-
20
-
21
- @dom({
22
- tag: "g",
23
- class: "block",
24
- autoGenerate: false
25
- })
26
- export default class Block extends SvgBase {
27
-
28
-
29
- public seats: Seats;
30
- public labels: Labels;
31
- public info: BlockInfo;
32
- public mask: BlockMask;
33
- public bounds: BlockBounds;
34
-
35
- public center_position: any = {
36
- x: null,
37
- y: null
38
- };
39
- public top_position: any = {
40
- x: null,
41
- y: null
42
- };
43
-
44
- constructor(public parent: BlocksManager, public item: BlockModel) {
45
- super(parent);
46
- this.attr("id", item.id);
47
- this.attr("opacity", 0);
48
-
49
-
50
- this.global.eventManager.addEventListener(EventType.ZOOM_LEVEL_CHANGE, (levelObject: any) => {
51
- if (levelObject.level === ZoomLevel.VENUE) {
52
- this.mask.blockLevelMask.show();
53
- this.mask.seatLevelMask.show();
54
- this.seats.resetSeatsColors(false);
55
- this.infosToCenter();
56
- } else if (levelObject.level === ZoomLevel.BLOCK) {
57
- this.mask.blockLevelMask.hide();
58
- this.mask.seatLevelMask.show();
59
- this.infosToTop();
60
- } else if (levelObject.level === ZoomLevel.SEAT) {
61
- this.mask.blockLevelMask.hide();
62
- this.mask.seatLevelMask.hide();
63
- this.seats.resetSeatsColors(false);
64
- this.infosToTop();
65
- }
66
- });
67
-
68
- this.global.eventManager.addEventListener(EventType.MULTI_SELECT_ENABLE, () => {
69
- this.seats.resetSeatsColors(false);
70
- });
71
- this.global.eventManager.addEventListener(EventType.MULTI_SELECT_DISABLE, () => {
72
- this.seats.resetSeatsColors(false);
73
- });
74
-
75
-
76
- // grid search
77
- this.global.eventManager.addEventListener(EventType.MOUSEMOVE_BLOCK, (block_item: Block) => {
78
-
79
- if (!this.parent.parent.searchCircle.is_enable) return;
80
- if (this.global.multi_select) return;
81
- let cor = d3Mouse(this.parent.parent.blocks.node.node());
82
- let gap = this.global.config.zoom_focus_circle_radius;
83
-
84
- if (this.global.zoomManager.zoomLevel === ZoomLevel.BLOCK) {
85
- for (let i = 0; i < block_item.seats.getSeatsCount(); i++) {
86
- let _seat = block_item.seats.getSeatByIndex(i);
87
- let _item: SeatModel = _seat.item;
88
- let color = _seat.getColor();
89
- if (_seat.isSelected()) {
90
- color = _seat.getColor(SeatAction.SELECT);
91
- } else {
92
- if ((_item.x - gap < cor[0] && _item.x + gap > cor[0]) && (_item.y - gap < cor[1] && _item.y + gap > cor[1])) {
93
- color = _seat.getColor(SeatAction.FOCUS);
94
- }
95
- _seat.setColor(color);
96
- }
97
-
98
-
99
- }
100
- }
101
- });
102
-
103
- this.global.eventManager.addEventListener(EventType.MOUSELEAVE_BLOCK, (block_item: Block) => {
104
- console.log(block_item)
105
- this.seats.resetSeatsColors()
106
-
107
- })
108
-
109
- // grid search
110
- // this.global.eventManager.addEventListener(EventType.TOUCHSTART_BLOCK, (block_item: Block) => {
111
- // console.log(block_item);
112
- // });
113
-
114
- this.parent.node.on("mouseleave.seats", () => {
115
- this.seats.resetSeatsColors(false);
116
- });
117
-
118
- return this;
119
- }
120
-
121
-
122
- public update() {
123
-
124
- // add Block Bounds container
125
- this.bounds = new BlockBounds(this, this.item);
126
- this.addChild(this.bounds);
127
-
128
-
129
- // add Seat container
130
- this.seats = new Seats(this, this.item);
131
- this.addChild(this.seats);
132
-
133
-
134
- // add Labels container
135
- this.labels = new Labels(this, this.item);
136
- this.addChild(this.labels);
137
-
138
-
139
- // add Block Info container
140
- this.mask = new BlockMask(this, this.item);
141
- this.addChild(this.mask);
142
-
143
-
144
- this.info = new BlockInfo(this, this.item);
145
- this.addChild(this.info);
146
-
147
-
148
- this.center_position.x = ((this.item.bounds[1][0] - this.item.bounds[2][0]) / 2) + this.item.bounds[2][0];
149
- this.center_position.y = ((this.item.bounds[0][1] - this.item.bounds[1][1]) / 2) + this.item.bounds[1][1];
150
-
151
- this.top_position.x = this.center_position.x;
152
- this.top_position.y = (this.item.bounds[1][1] - 50);
153
-
154
-
155
- // update childs
156
- this.updateChilds();
157
-
158
-
159
- this.infosToCenter();
160
-
161
-
162
- this.node.interrupt().transition().duration(this.global.config.animation_speed).attr("opacity", 1);
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
-
169
-
170
- return this;
171
- }
172
-
173
- public infosToTop() {
174
- if (this.info.node && this.top_position.x)
175
- this.info.node.interrupt().transition().duration(this.global.config.animation_speed).attr("transform", "translate(" + this.top_position.x + "," + this.top_position.y + ")").attr("opacity", 1).attr("font-size", 14).attr("fill", "#ffffff");
176
- }
177
-
178
- public infosToCenter() {
179
- if (this.info.node && this.center_position.x)
180
- this.info.node.interrupt().transition().duration(this.global.config.animation_speed).attr("transform", "translate(" + this.center_position.x + "," + this.center_position.y + ")").attr("opacity", 1).attr("font-size", 28).attr("fill", "#ffffff");
181
-
182
- }
183
-
184
-
185
- }
@@ -1,39 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
- import SvgBase from "../../../svg.base";
7
- import {dom} from "../../../../decorators/dom";
8
- import BlockModel from "../../../../models/block.model";
9
- import Block from "./block-item.index";
10
- import {BlockTitle} from "./info/title";
11
-
12
- @dom({
13
- tag: "g",
14
- class: "info",
15
- autoGenerate: false
16
- })
17
- export default class BlockInfo extends SvgBase {
18
-
19
- public title: BlockTitle;
20
-
21
-
22
- constructor(public parent: Block, public item: BlockModel) {
23
- super(parent);
24
- console.log('item',item)
25
- this.attr("opacity", 0);
26
- let x = ((this.item.bounds[1][0] - this.item.bounds[2][0]) / 2) + this.item.bounds[2][0];
27
- let y = ((this.item.bounds[0][1] - this.item.bounds[1][1]) / 2) + this.item.bounds[1][1];
28
- this.attr("transform", "translate(" + [x, y] + ")");
29
- return this;
30
- }
31
-
32
- update(): this {
33
- this.title = new BlockTitle(this);
34
- this.addChild(this.title);
35
- this.updateChilds();
36
- this.title.node.text(this.parent.item.title);
37
- return this;
38
- }
39
- }
@@ -1,41 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
-
7
- import SvgBase from "../../../svg.base";
8
- import {dom} from "../../../../decorators/dom";
9
- import Block from "./block-item.index";
10
- import BlockModel from "../../../../models/block.model";
11
- import {LabelItem} from "./label/label-item.index";
12
- import LabelModel from "../../../../models/label.model";
13
-
14
-
15
- @dom({
16
- tag: "g",
17
- class: "labels",
18
- autoGenerate: false
19
- })
20
- export default class Labels extends SvgBase {
21
-
22
- constructor(public parent: Block, public item: BlockModel) {
23
- super(parent);
24
- return this;
25
- }
26
-
27
- update(): this {
28
- // add seat items in blockItem container
29
- this.item.labels.map((label: LabelModel) => {
30
- this.addChild(new LabelItem(this, label))
31
- });
32
- this.updateChilds();
33
- return this;
34
- }
35
-
36
- // Getting labels method
37
- // ex: seatmap.stage.blocks.getBlock(2).seats.getSeat("1-1")
38
- public getLabels(): Array<LabelItem> {
39
- return this.child_items;
40
- }
41
- }
@@ -1,67 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
- import SvgBase from "../../../svg.base";
7
- import {dom} from "../../../../decorators/dom";
8
- import BlockModel from "../../../../models/block.model";
9
- import Block from "./block-item.index";
10
- import {BoundItem} from "./bound/bound-item.index";
11
- import {EventType} from "../../../../enums/global";
12
-
13
- @dom({
14
- tag: "g",
15
- class: "masks",
16
- autoGenerate: false
17
- })
18
- export default class BlockMask extends SvgBase {
19
-
20
- public blockLevelMask: BoundItem;
21
- public seatLevelMask: BoundItem;
22
-
23
- constructor(public parent: Block, public item: BlockModel) {
24
- super(parent);
25
-
26
- this.global.eventManager.addEventListener(EventType.BOUND_CLICK, (bound: BoundItem) => {
27
- if(this.global.multi_select)return;
28
- let _block = bound.parent.parent.item;
29
- if (bound.hasTag("block-level")) {
30
- parent.global.zoomManager.zoomToBlock(_block.id);
31
- } else if (bound.hasTag("seat-level")) {
32
- parent.global.zoomManager.zoomToSelection();
33
- }
34
- });
35
-
36
-
37
- return this;
38
- }
39
-
40
- update(): this {
41
-
42
- // add Border Bounds container
43
- this.seatLevelMask = new BoundItem(this, this.item);
44
- this.seatLevelMask.attr("fill", this.item.color);
45
- this.seatLevelMask.attr("stroke-width", 59);
46
- this.seatLevelMask.attr("stroke", this.item.color);
47
- this.seatLevelMask.tags.push("seat-level");
48
- this.seatLevelMask.classed("seat-level-mask");
49
-
50
-
51
- // add Border Bounds container
52
- this.blockLevelMask = new BoundItem(this, this.item);
53
- this.blockLevelMask.attr("fill", this.item.color);
54
- this.blockLevelMask.attr("stroke-width", 59);
55
- this.blockLevelMask.attr("stroke", this.item.color);
56
- this.blockLevelMask.tags.push("block-level");
57
- this.blockLevelMask.classed("block-level-mask");
58
-
59
- this.addChild(this.seatLevelMask);
60
- this.addChild(this.blockLevelMask);
61
-
62
-
63
- this.updateChilds();
64
-
65
- return this;
66
- }
67
- }
@@ -1,81 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
-
7
- import SvgBase from "../../../svg.base";
8
- import {dom} from "../../../../decorators/dom";
9
- import Block from "./block-item.index";
10
- import SeatModel from "../../../../models/seat.model";
11
- import {SeatItem} from "./seat/seat-item.index";
12
- import BlockModel from "../../../../models/block.model";
13
- import {EventType, SeatAction} from "../../../../enums/global";
14
-
15
-
16
- @dom({
17
- tag: "g",
18
- class: "seats",
19
- autoGenerate: false
20
- })
21
- export default class Seats extends SvgBase {
22
-
23
- constructor(public parent: Block, public item: BlockModel) {
24
- super(parent);
25
-
26
- this.global.eventManager.addEventListener(EventType.MOUSEENTER_SEAT, (seat: SeatItem) => {
27
- if (this.global.multi_select) return;
28
- seat.setColor(seat.getColor(SeatAction.HOVER));
29
- //this.global.zoomManager.zoomDisable();
30
- });
31
- this.global.eventManager.addEventListener(EventType.MOUSELEAVE_SEAT, (seat: SeatItem) => {
32
- seat.setColor(seat.getColor());
33
- //this.global.zoomManager.zoomEnable();
34
- });
35
-
36
- return this;
37
- }
38
-
39
- update(): this {
40
- // add seat items in blockItem container
41
- this.item.seats.forEach((seat: SeatModel) => {
42
- this.addChild(new SeatItem(this, seat), {id: seat.id})
43
- });
44
- this.updateChilds();
45
- return this;
46
- }
47
-
48
- // Getting seat method
49
- // ex: seatmap.stage.blocks.getBlock(2).seats.getSeat("1-1")
50
- public getSeat(id: any): SeatItem {
51
- return this.child_items.find((seat: SeatItem) => seat.item.id == id);
52
- }
53
-
54
- // Getting seats method
55
- // ex: seatmap.stage.blocks.getBlock(2).seats.getSeat("1-1")
56
- public getSeats(): Array<SeatItem> {
57
- return this.child_items;
58
- }
59
-
60
- public getSeatsCount(): number {
61
- return this.child_items.length;
62
- }
63
-
64
- public getSeatByIndex(index: number): SeatItem {
65
- return this.child_items[index];
66
- }
67
-
68
- public resetSeatsColors(animation: boolean = false) {
69
- for (let i = 0; i < this.getSeatsCount(); i++) {
70
- let _seat = this.getSeatByIndex(i);
71
- let _item: SeatModel = _seat.item;
72
-
73
- let color = _seat.getColor();
74
-
75
- if (!_seat.isSelected() && _seat.isSalable()) {
76
- color = _seat.getColor(SeatAction.LEAVE);
77
- _seat.setColor(color, animation);
78
- }
79
- }
80
- }
81
- }
@@ -1,43 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
-
7
- import SvgBase from "../../../../svg.base";
8
- import {dom} from "../../../../../decorators/dom";
9
- import BlockBounds from "../block-item.bounds";
10
- import BlockModel from "../../../../../models/block.model";
11
- import BlockMask from "../block-item.mask";
12
-
13
-
14
- @dom({
15
- tag: "path",
16
- class: "bound",
17
- autoGenerate: false
18
- })
19
- export class BoundItem extends SvgBase {
20
-
21
-
22
- constructor(public parent: BlockBounds|BlockMask, public item: BlockModel) {
23
- super(parent);
24
- }
25
-
26
- show(){
27
- this.node.classed("bound-hide",false);
28
- }
29
-
30
- hide(){
31
- this.node.classed("bound-hide",true);
32
- }
33
-
34
- update(): this {
35
- this.updateChilds();
36
- this.node
37
- .datum(this.item.bounds)
38
- .attr("d", function (d: any) {
39
- return "M" + d.join("L") + "Z";
40
- });
41
- return this;
42
- }
43
- }
@@ -1,30 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
-
7
- import SvgBase from "../../../../svg.base";
8
- import {dom} from "../../../../../decorators/dom";
9
- import BlockInfo from "../block-item.info.index";
10
-
11
-
12
- @dom({
13
- tag: "text",
14
- class: "title",
15
- autoGenerate: false
16
- })
17
- export class BlockTitle extends SvgBase {
18
-
19
-
20
- constructor(public parent: BlockInfo) {
21
- super(parent);
22
- this.attr("fill",this.global.config.block_style.title_color);
23
-
24
- }
25
-
26
-
27
- update(): this {
28
- return this;
29
- }
30
- }