@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,37 +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 BlocksSearchCircle from "../blocks.search-circle";
10
-
11
- @dom({
12
- tag: "circle",
13
- class: "circle",
14
- autoGenerate: false
15
- })
16
- export default class Circle extends SvgBase {
17
-
18
-
19
- constructor(public parent: BlocksSearchCircle) {
20
- super(parent);
21
- // .attr("r", this.defaults.zoom_focus_circle_radius)
22
- // .style("display", "none")
23
- // .classed("zoom-circle", true);
24
-
25
- this.attr("r", this.parent.global.config.zoom_focus_circle_radius);
26
-
27
-
28
- return this;
29
- }
30
-
31
- update(): this {
32
-
33
- this.updateChilds();
34
-
35
- return this;
36
- }
37
- }
@@ -1,41 +0,0 @@
1
- /*
2
- * index.ts
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
- import Blocks from "./blocks/blocks.index";
7
- import Svg from "../svg.index";
8
- import SvgBase from "../svg.base";
9
- import {dom} from "../../decorators/dom";
10
- import BlocksSearchCircle from "./blocks.search-circle";
11
-
12
-
13
-
14
- @dom({
15
- tag: "g",
16
- class: "stage",
17
- autoGenerate: false
18
- })
19
- export default class Stage extends SvgBase {
20
-
21
- public blocks: Blocks;
22
- public searchCircle:BlocksSearchCircle;
23
-
24
- constructor(public parent: Svg) {
25
- super(parent);
26
- }
27
-
28
-
29
- update() {
30
- this.blocks = new Blocks(this);
31
- this.addChild(this.blocks);
32
-
33
- this.searchCircle = new BlocksSearchCircle(this);
34
- this.addChild(this.searchCircle);
35
-
36
-
37
- this.updateChilds();
38
- }
39
-
40
-
41
- }
@@ -1,229 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
- import Block from "./stage/blocks/block-item/block-item.index";
7
- import {GlobalModel} from "../models/global.model";
8
- import {EventObject} from "./event.manager";
9
- import {mouse as d3Mouse} from 'd3-selection'
10
-
11
-
12
- export default class SvgBase {
13
-
14
- public node: any | null = null;
15
- public domClass: string | null;
16
- public domTag: string | null;
17
- public eventCode: string | null;
18
- public autoGenerate: boolean = false;
19
- public tags: Array<string>;
20
-
21
- public child_items: Array<any> | any;
22
-
23
- public dom_attrs: Array<any>;
24
- public dom_classes: Array<any>;
25
-
26
- public child_index: number | null = null;
27
-
28
- public domText: string | null = null;
29
-
30
-
31
- public global: GlobalModel;
32
-
33
- constructor(public parent: any) {
34
- this.child_items = [];
35
- this.dom_attrs = [];
36
- this.dom_classes = [];
37
- this.tags = [];
38
-
39
- this.eventCode = null;
40
-
41
- if (typeof parent.global !== "undefined") {
42
- this.global = parent.global;
43
- }
44
-
45
- if (Object(this).dom_params) {
46
-
47
- if (Object(this).dom_params['tag']) {
48
- this.domTag = Object(this).dom_params['tag'];
49
- }
50
- if (Object(this).dom_params['class']) {
51
- this.domClass = Object(this).dom_params['class'];
52
- }
53
- if (Object(this).dom_params['event_code']) {
54
- this.eventCode = Object(this).dom_params['event_code'];
55
- }
56
- }
57
- if (typeof Object(this).dom_params['autoGenerate'] !== "undefined" && Object(this).dom_params['autoGenerate'] === true) {
58
- this.autoGenerate = true;
59
- }
60
- this.generateThisDom();
61
- return this;
62
- }
63
-
64
- public generateThisDom(): this {
65
- if (this.autoGenerate) {
66
- this.domGenerate(this.parent.node);
67
- this.afterGenerate();
68
- }
69
-
70
- return this;
71
-
72
- }
73
-
74
- public domGenerate(to: any, index: number = 0): this {
75
- let domTag = this.domTag ? this.domTag : "g";
76
- this.child_index = index;
77
-
78
- this.node = to.datum(this.parent).append(domTag);
79
-
80
- for (let di = 0; di < this.dom_attrs.length; di++) {
81
- let _dom_attr = this.dom_attrs[di];
82
- this.node.attr(_dom_attr.name, _dom_attr.value)
83
- }
84
- if(this.domText){
85
- this.node.text(this.domText)
86
- }
87
-
88
- if (this.domClass) {
89
- this.node.classed(this.domClass, true);
90
- }
91
-
92
-
93
- for (let ci = 0; ci < this.dom_classes.length; ci++) {
94
- let _dom_class = this.dom_classes[ci];
95
- this.node.classed(_dom_class.name, _dom_class.value);
96
- }
97
-
98
- return this;
99
- }
100
-
101
- public attr(name: string, value: string | number): this {
102
- this.dom_attrs.push({
103
- name: name,
104
- value: value
105
- });
106
- return this;
107
- }
108
-
109
- public text(value: string): this {
110
- // this.text(value)
111
- this.domText = value;
112
- return this;
113
- }
114
-
115
- public addChild(item: any, attrs?: any, replace: boolean = true): this {
116
- for (let key in attrs) {
117
- let value = attrs[key];
118
- item.dom_attrs.push({
119
- name: key,
120
- value: value
121
- })
122
- }
123
-
124
- this.child_items.push(item);
125
- return this;
126
- }
127
-
128
- public classed(className: string, value: boolean = true): this {
129
- this.dom_classes.push({
130
- name: className,
131
- value: value
132
- });
133
- return this;
134
- }
135
-
136
-
137
- public clear(): this {
138
- this.child_items.map((item: Block) => {
139
- item.node.remove()
140
- });
141
- this.child_items = [];
142
- return this;
143
- }
144
-
145
- public updateChilds(): this {
146
- this.child_items.map((item: Block, index: number) => {
147
- item.domGenerate(this.node, index);
148
- item.update();
149
- });
150
- this.afterGenerate();
151
- this.updateEvents(false);
152
- return this;
153
- }
154
-
155
- public updateEvents(recursive: boolean = false): this {
156
- let _self = this;
157
- let allowed_event_types: Array<string> = ["click", "mousever", "mouseleave", "mouseout", "mouseenter", "mousemove", "keydown", "keypress", "mousedown", "mouseup", "touchstart"];
158
- if (this.eventCode) {
159
- for (let i = 0; i < this.global.eventManager.events.length; i++) {
160
- let _event = this.global.eventManager.events[i];
161
- let _split = _event.type.toString().split(".");
162
- if (_split[0].toLowerCase() === this.eventCode.toLowerCase() && allowed_event_types.indexOf(_split[1].toLowerCase()) !== -1 && typeof _split[1] !== "undefined") {
163
- this.node.on(_split[1].toLowerCase() + ".globalevent", function (item: EventObject) {
164
- let _mouse = d3Mouse(_self.parent.node.node());
165
- _event.fn(_self, item, _mouse);
166
- })
167
- }
168
- }
169
-
170
- if (recursive && this.child_items.length > 0) {
171
- this.child_items.map((child_item: any) => {
172
- if (typeof child_item.updateEvents === "function") {
173
- child_item.updateEvents(true);
174
- }
175
- })
176
- }
177
- }
178
-
179
-
180
- return this;
181
- }
182
-
183
- public addEventListener(eventType: string, cb: any): this {
184
- this.global.eventManager.addEventListener(eventType, cb);
185
- this.updateEvents(false);
186
- return this;
187
- }
188
-
189
- public addTag(tag: string): this {
190
- this.tags.push(tag);
191
- return this;
192
- }
193
-
194
- public hasTag(tag: string): boolean {
195
- return this.tags.indexOf(tag) !== -1
196
- }
197
-
198
- public getChilds(type: string | null = null): Array<any> {
199
- if (type === null) {
200
- return this.child_items.filter((item: any) => item.constructor.name === type);
201
- } else {
202
- return this.child_items;
203
- }
204
- }
205
-
206
- public getChildCount(): number {
207
- return this.child_items.length;
208
- }
209
-
210
- public beforeGenerate() {
211
-
212
- }
213
-
214
- public afterGenerate() {
215
-
216
- }
217
-
218
- public addToParent(): this {
219
- this.parent.addChild(this);
220
- return this;
221
- }
222
-
223
- public addTo(container: any): this {
224
- container.addChild(this);
225
- return this;
226
- }
227
-
228
-
229
- }
@@ -1,76 +0,0 @@
1
- /*
2
- * $project.fileName
3
- * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
- */
5
-
6
- import Stage from "./stage/stage.index";
7
- import {mouse as d3Mouse} from 'd3-selection'
8
- import "reflect-metadata";
9
-
10
- import {SeatMapCanvas} from "../canvas.index";
11
- import SvgBase from "./svg.base";
12
- import {dom} from "../decorators/dom";
13
- import {EventType, ZoomLevel} from "../enums/global";
14
- import ZoomOutBg from "./zoom-out.bg";
15
- import Legend from "./legend";
16
- import Tooltip from "./tooltip";
17
-
18
-
19
-
20
- declare const window: any;
21
-
22
- @dom({
23
- tag: "svg",
24
- class: "seatmap-svg",
25
- autoGenerate: false
26
- })
27
- export default class Svg extends SvgBase {
28
- public stage: Stage;
29
- public zoomOutBg: ZoomOutBg;
30
- public legend: Legend;
31
- public tooltip: Tooltip;
32
-
33
-
34
- constructor(public parent: SeatMapCanvas) {
35
- super(parent);
36
- this.global.eventManager.addEventListener(EventType.ZOOM_LEVEL_CHANGE, (zoom_level: any) => {
37
- this.node.classed("zoom-level-" + ZoomLevel.SEAT, false);
38
- this.node.classed("zoom-level-" + ZoomLevel.BLOCK, false);
39
- this.node.classed("zoom-level-" + ZoomLevel.VENUE, false);
40
- this.node.classed("zoom-level-" + zoom_level.level, true);
41
- });
42
-
43
-
44
- //this.update();
45
- }
46
-
47
- update() {
48
- this.stage = new Stage(this).addToParent();
49
- this.zoomOutBg = new ZoomOutBg(this).addToParent();
50
- if(this.global.config.legend_show){
51
- this.legend = new Legend(this).addToParent();
52
- }
53
-
54
- this.tooltip = new Tooltip(this).addToParent();
55
-
56
-
57
- this.updateChilds();
58
-
59
- this.stage.node.raise();
60
- if(this.global.config.legend_show){
61
- this.legend.node.raise();
62
- }
63
-
64
- this.tooltip.node.raise();
65
-
66
- this.node.on("mousemove", () => {
67
- let cor = d3Mouse(this.stage.node.node());
68
- this.parent.eventManager.dispatch(EventType.MOUSE_MOVE, cor);
69
- })
70
-
71
-
72
- //this.stage.updateEvents(true);
73
- }
74
-
75
-
76
- }
@@ -1,66 +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
-
10
- import {line as d3Line} from "d3-shape";
11
- import Tooltip from "../tooltip";
12
-
13
- @dom({
14
- tag: "rect",
15
- class: "tooltip-rect",
16
- autoGenerate: false
17
- })
18
- export default class TooltipRect extends SvgBase {
19
-
20
-
21
- constructor(public parent: Tooltip) {
22
- super(parent);
23
- this.attr("width", this.global.config.tooltip_style.width);
24
- this.attr("height", this.global.config.tooltip_style.height);
25
- this.attr("x", 0);
26
- this.attr("y", 0);
27
- this.attr("rx", 3);
28
- this.attr("ry", 3);
29
-
30
- const data:any = [
31
- {'x': 0, 'y': 0},
32
- {'x': 0, 'y': 30},
33
- {'x': 30, 'y': 30},
34
- {'x': 30, 'y': 0},
35
- {'x': 0, 'y': 0},
36
- ];
37
-
38
- const line = d3Line()
39
- .x((d: any) => {
40
- return d['x'];
41
- })
42
- .y((d: any) => {
43
- return d['y'];
44
- });
45
-
46
- this.attr("fill", this.global.config.tooltip_style.bg);
47
- this.attr("stroke", "rgba(0,0,0,0.3)");
48
- this.attr("stroke-width", "1px");
49
- this.attr("opacity", 0.8);
50
-
51
- //this.attr('d', line(data));
52
-
53
-
54
- return this;
55
- }
56
-
57
- update(): this {
58
- this.updateChilds();
59
- return this;
60
- }
61
-
62
- afterGenerate() {
63
-
64
- this.node.style("pointer-events", "none");
65
- }
66
- }
@@ -1,48 +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 Tooltip from "../tooltip";
10
-
11
- @dom({
12
- tag: "text",
13
- class: "tooltip-title",
14
- autoGenerate: false
15
- })
16
- export default class TooltipTitle extends SvgBase {
17
-
18
- title: Array<string>;
19
-
20
- constructor(public parent: Tooltip) {
21
- super(parent);
22
- this.attr("x", 6);
23
- this.attr("y", 21);
24
- this.attr("fill", this.global.config.tooltip_style.color);
25
- return this;
26
- }
27
-
28
- update(): this {
29
- this.updateChilds();
30
- return this;
31
- }
32
-
33
- afterGenerate() {
34
-
35
- this.node.style("pointer-events", "none");
36
- this.node.style("font-size", "12px");
37
- }
38
-
39
- generateTitle() {
40
- this.node.selectAll("tspan").remove()
41
- .data(this.title).enter()
42
- .append("tspan")
43
- .text((item: string) => item)
44
- .attr("x", 6)
45
- .attr("y", (line: any, index: number) => (index * 16) + 16);
46
- }
47
-
48
- }
@@ -1,93 +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
-
10
- import TooltipRect from "./tooltip/rect";
11
- import {EventType, ZoomLevel} from "../enums/global";
12
-
13
-
14
- import Svg from "./svg.index";
15
- import {SeatItem} from "./stage/blocks/block-item/seat/seat-item.index";
16
-
17
- import {mouse as d3Mouse} from 'd3-selection'
18
- import TooltipTitle from "./tooltip/title";
19
-
20
- @dom({
21
- tag: "g",
22
- class: "seatmap-tooltip",
23
- autoGenerate: false
24
- })
25
- export default class Tooltip extends SvgBase {
26
-
27
-
28
- public rect: TooltipRect;
29
- public title: TooltipTitle;
30
-
31
- public activeSeat: SeatItem | null;
32
-
33
- constructor(public parent: Svg) {
34
- super(parent);
35
- this.attr("transform", "translate(0,0)");
36
- this.attr("opacity", 0);
37
-
38
- this.activeSeat = null;
39
-
40
-
41
- this.global.eventManager.addEventListener([EventType.MOUSEMOVE_SEAT], (seat: SeatItem) => {
42
- if (this.global.multi_select) return;
43
- if (this.activeSeat !== seat && seat.item.title) {
44
- this.activeSeat = seat;
45
- this.setTitle(seat.item.title.split("\n"));
46
- this.title.generateTitle();
47
- }
48
- });
49
- this.global.eventManager.addEventListener([EventType.MOUSEOUT_SEAT], (seat: SeatItem) => {
50
- this.node.attr("opacity", 0);
51
- this.activeSeat = null;
52
- this.title.title = [];
53
- this.title.generateTitle();
54
- });
55
- this.global.eventManager.addEventListener([EventType.TOUCHSTART_BLOCK], (seat: SeatItem) => {
56
- this.node.attr("opacity", 0);
57
- });
58
- return this;
59
- }
60
-
61
- public setTitle(title: Array<string>): this {
62
- this.title.title = title;
63
- return this;
64
- }
65
-
66
- update(): this {
67
- this.rect = new TooltipRect(this).addTo(this);
68
- this.title = new TooltipTitle(this).addTo(this);
69
-
70
-
71
- this.updateChilds();
72
- return this;
73
- }
74
-
75
- afterGenerate() {
76
-
77
- let _self = this;
78
-
79
- this.parent.node.on("mousemove.seat", function () {
80
- if (_self.global.multi_select) return;
81
- if (_self.global.zoomManager.zoomLevel === ZoomLevel.SEAT && _self.activeSeat !== null) {
82
- // @ts-ignore
83
- let cor = d3Mouse(this);
84
-
85
- let x = cor[0] - (_self.global.config.tooltip_style.width / 2);
86
- let y = cor[1] - (_self.global.config.tooltip_style.height + (_self.global.config.seat_style.radius) + 2);
87
- _self.node.attr("transform", "translate(" + [x, y] + ")").attr("opacity", 1);
88
- } else {
89
- _self.node.attr("opacity", 0);
90
- }
91
- })
92
- }
93
- }
@@ -1,35 +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 {EventType} from "../enums/global";
11
-
12
- @dom({
13
- tag: "rect",
14
- class: "zoom-out-bg",
15
- autoGenerate: false
16
- })
17
- export default class ZoomOutBg extends SvgBase {
18
-
19
- constructor(public parent: Svg) {
20
- super(parent);
21
- this.global.eventManager.addEventListener(EventType.RESIZE_WINDOW, (win: any) => {
22
-
23
- this.node
24
- .attr("width", win.width)
25
- .attr("height", win.height)
26
- .on("click.zoomout", () => {
27
- this.global.eventManager.dispatch(EventType.CLICK_ZOOM_OUT, this);
28
- });
29
- })
30
- }
31
-
32
- update() {
33
-
34
- }
35
- }