@alisaitteke/seatmap-canvas 2.1.0 → 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.
Files changed (70) hide show
  1. package/.github/workflows/publish.yml +6 -3
  2. package/.opencommitignore +2 -4
  3. package/CHANGELOG.md +3 -1
  4. package/README.md +3 -5
  5. package/dist/cjs/index.js +16 -0
  6. package/examples/index.html +171 -0
  7. package/package.json +19 -12
  8. package/rollup.config.js +56 -0
  9. package/src/lib/canvas.index.ts +2 -3
  10. package/src/lib/config.ts +1 -1
  11. package/src/lib/decorators/dom.ts +1 -1
  12. package/src/lib/decorators/index.ts +1 -1
  13. package/src/lib/dev.tools.ts +1 -1
  14. package/src/lib/enums/global.ts +3 -3
  15. package/src/lib/models/block.model.ts +23 -128
  16. package/src/lib/models/coordinate.model.ts +3 -20
  17. package/src/lib/models/data.model.ts +29 -9
  18. package/src/lib/models/defaults.model.ts +10 -4
  19. package/src/lib/models/global.model.ts +1 -1
  20. package/src/lib/models/label.model.ts +5 -38
  21. package/src/lib/models/legend.model.ts +6 -38
  22. package/src/lib/models/model.base.ts +5 -22
  23. package/src/lib/models/seat.model.ts +18 -126
  24. package/src/lib/svg/event.manager.ts +6 -14
  25. package/src/lib/svg/legend/legend.circle.ts +1 -1
  26. package/src/lib/svg/legend/legend.item.ts +7 -4
  27. package/src/lib/svg/legend/legend.title.ts +2 -2
  28. package/src/lib/svg/legend.ts +1 -1
  29. package/src/lib/svg/stage/blocks/block-item/block-item.bounds.ts +1 -1
  30. package/src/lib/svg/stage/blocks/block-item/block-item.index.ts +17 -5
  31. package/src/lib/svg/stage/blocks/block-item/block-item.info.index.ts +2 -1
  32. package/src/lib/svg/stage/blocks/block-item/block-item.labels.index.ts +1 -1
  33. package/src/lib/svg/stage/blocks/block-item/block-item.mask.ts +1 -1
  34. package/src/lib/svg/stage/blocks/block-item/block-item.seats.index.ts +1 -1
  35. package/src/lib/svg/stage/blocks/block-item/bound/bound-item.index.ts +1 -1
  36. package/src/lib/svg/stage/blocks/block-item/info/title.ts +1 -1
  37. package/src/lib/svg/stage/blocks/block-item/label/label-item.circle.ts +1 -1
  38. package/src/lib/svg/stage/blocks/block-item/label/label-item.index.ts +1 -1
  39. package/src/lib/svg/stage/blocks/block-item/label/label-item.title.ts +1 -1
  40. package/src/lib/svg/stage/blocks/block-item/seat/seat-item.check.ts +12 -5
  41. package/src/lib/svg/stage/blocks/block-item/seat/seat-item.circle.ts +1 -1
  42. package/src/lib/svg/stage/blocks/block-item/seat/seat-item.index.ts +4 -4
  43. package/src/lib/svg/stage/blocks/block-item/seat/seat-item.title.ts +1 -1
  44. package/src/lib/svg/stage/blocks/blocks.index.ts +8 -5
  45. package/src/lib/svg/stage/blocks.search-circle.ts +1 -1
  46. package/src/lib/svg/stage/multi-select/rect.ts +1 -1
  47. package/src/lib/svg/stage/multi-select.ts +1 -1
  48. package/src/lib/svg/stage/search-circle/circle.ts +1 -1
  49. package/src/lib/svg/stage/stage.index.ts +1 -1
  50. package/src/lib/svg/svg.base.ts +40 -28
  51. package/src/lib/svg/svg.index.ts +1 -1
  52. package/src/lib/svg/tooltip/rect.ts +1 -1
  53. package/src/lib/svg/tooltip/title.ts +2 -11
  54. package/src/lib/svg/tooltip.ts +4 -3
  55. package/src/lib/svg/zoom-out.bg.ts +2 -2
  56. package/src/lib/svg/zoom.manager.ts +56 -48
  57. package/src/lib/window.manager.ts +3 -3
  58. package/tsconfig.json +21 -17
  59. package/dist/seatmap.canvas.2.0.1-0.css +0 -1
  60. package/dist/seatmap.canvas.2.0.1-0.js +0 -2
  61. package/dist/seatmap.canvas.2.0.1-0.js.LICENSE.txt +0 -14
  62. package/examples/basic/bootstrap.min.css +0 -7
  63. package/examples/basic/index.html +0 -201
  64. package/examples/basic/jquery.min.js +0 -2
  65. package/examples/data/data.json +0 -70007
  66. package/examples/data/small.json +0 -1307
  67. package/examples/data/tiny.json +0 -119
  68. package/examples/old/index.html +0 -262
  69. package/webpack.environments/development.js +0 -58
  70. package/webpack.environments/production.js +0 -52
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * $project.fileName
3
- * https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
3
+ * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
4
  */
5
5
 
6
6
  import Block from "./stage/blocks/block-item/block-item.index";
@@ -11,19 +11,21 @@ import {mouse as d3Mouse} from 'd3-selection'
11
11
 
12
12
  export default class SvgBase {
13
13
 
14
- public node: any = null;
15
- public domClass: string = null;
16
- public domTag: string = null;
17
- public eventCode: string = null;
14
+ public node: any | null = null;
15
+ public domClass: string | null;
16
+ public domTag: string | null;
17
+ public eventCode: string | null;
18
18
  public autoGenerate: boolean = false;
19
19
  public tags: Array<string>;
20
20
 
21
21
  public child_items: Array<any> | any;
22
22
 
23
23
  public dom_attrs: Array<any>;
24
- public dom_classeds: Array<any>;
24
+ public dom_classes: Array<any>;
25
25
 
26
- public child_index: number = null;
26
+ public child_index: number | null = null;
27
+
28
+ public domText: string | null = null;
27
29
 
28
30
 
29
31
  public global: GlobalModel;
@@ -31,7 +33,7 @@ export default class SvgBase {
31
33
  constructor(public parent: any) {
32
34
  this.child_items = [];
33
35
  this.dom_attrs = [];
34
- this.dom_classeds = [];
36
+ this.dom_classes = [];
35
37
  this.tags = [];
36
38
 
37
39
  this.eventCode = null;
@@ -79,14 +81,17 @@ export default class SvgBase {
79
81
  let _dom_attr = this.dom_attrs[di];
80
82
  this.node.attr(_dom_attr.name, _dom_attr.value)
81
83
  }
84
+ if(this.domText){
85
+ this.node.text(this.domText)
86
+ }
82
87
 
83
88
  if (this.domClass) {
84
89
  this.node.classed(this.domClass, true);
85
90
  }
86
91
 
87
92
 
88
- for (let ci = 0; ci < this.dom_classeds.length; ci++) {
89
- let _dom_class = this.dom_classeds[ci];
93
+ for (let ci = 0; ci < this.dom_classes.length; ci++) {
94
+ let _dom_class = this.dom_classes[ci];
90
95
  this.node.classed(_dom_class.name, _dom_class.value);
91
96
  }
92
97
 
@@ -101,6 +106,12 @@ export default class SvgBase {
101
106
  return this;
102
107
  }
103
108
 
109
+ public text(value: string): this {
110
+ // this.text(value)
111
+ this.domText = value;
112
+ return this;
113
+ }
114
+
104
115
  public addChild(item: any, attrs?: any, replace: boolean = true): this {
105
116
  for (let key in attrs) {
106
117
  let value = attrs[key];
@@ -115,7 +126,7 @@ export default class SvgBase {
115
126
  }
116
127
 
117
128
  public classed(className: string, value: boolean = true): this {
118
- this.dom_classeds.push({
129
+ this.dom_classes.push({
119
130
  name: className,
120
131
  value: value
121
132
  });
@@ -143,27 +154,28 @@ export default class SvgBase {
143
154
 
144
155
  public updateEvents(recursive: boolean = false): this {
145
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
+ }
146
169
 
147
- let allowed_event_types: Array<string> = ["click", "mousever", "mouseleave", "mouseout", "mouseenter", "mousemove", "keydown", "keypress", "mousedown", "mouseup","touchstart"];
148
-
149
- for (let i = 0; i < this.global.eventManager.events.length; i++) {
150
- let _event = this.global.eventManager.events[i];
151
- let _split = _event.type.toString().split(".");
152
- if (_split[0].toLowerCase() === this.eventCode.toLowerCase() && allowed_event_types.indexOf(_split[1].toLowerCase()) !== -1 && typeof _split[1] !== "undefined") {
153
- this.node.on(_split[1].toLowerCase() + ".globalevent", function (item: EventObject) {
154
- let _mouse = d3Mouse(_self.parent.node.node());
155
- _event.fn(_self, item, _mouse);
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
+ }
156
175
  })
157
176
  }
158
177
  }
159
178
 
160
- if (recursive && this.child_items.length > 0) {
161
- this.child_items.map((child_item: any) => {
162
- if (typeof child_item.updateEvents === "function") {
163
- child_item.updateEvents(true);
164
- }
165
- })
166
- }
167
179
 
168
180
  return this;
169
181
  }
@@ -183,7 +195,7 @@ export default class SvgBase {
183
195
  return this.tags.indexOf(tag) !== -1
184
196
  }
185
197
 
186
- public getChilds(type: string = null): Array<any> {
198
+ public getChilds(type: string | null = null): Array<any> {
187
199
  if (type === null) {
188
200
  return this.child_items.filter((item: any) => item.constructor.name === type);
189
201
  } else {
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * $project.fileName
3
- * https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
3
+ * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
4
  */
5
5
 
6
6
  import Stage from "./stage/stage.index";
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * $project.fileName
3
- * https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
3
+ * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * $project.fileName
3
- * https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
3
+ * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
4
  */
5
5
 
6
6
 
@@ -15,7 +15,7 @@ import Tooltip from "../tooltip";
15
15
  })
16
16
  export default class TooltipTitle extends SvgBase {
17
17
 
18
- private _title: Array<string>;
18
+ title: Array<string>;
19
19
 
20
20
  constructor(public parent: Tooltip) {
21
21
  super(parent);
@@ -45,13 +45,4 @@ export default class TooltipTitle extends SvgBase {
45
45
  .attr("y", (line: any, index: number) => (index * 16) + 16);
46
46
  }
47
47
 
48
-
49
- get title(): Array<string> {
50
- return this._title;
51
- }
52
-
53
- set title(value: Array<string>) {
54
- this._title = value;
55
- //this.generateTitle();
56
- }
57
48
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * $project.fileName
3
- * https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
3
+ * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
4
  */
5
5
 
6
6
 
@@ -28,7 +28,7 @@ export default class Tooltip extends SvgBase {
28
28
  public rect: TooltipRect;
29
29
  public title: TooltipTitle;
30
30
 
31
- public activeSeat: SeatItem;
31
+ public activeSeat: SeatItem | null;
32
32
 
33
33
  constructor(public parent: Svg) {
34
34
  super(parent);
@@ -40,7 +40,7 @@ export default class Tooltip extends SvgBase {
40
40
 
41
41
  this.global.eventManager.addEventListener([EventType.MOUSEMOVE_SEAT], (seat: SeatItem) => {
42
42
  if (this.global.multi_select) return;
43
- if (this.activeSeat !== seat) {
43
+ if (this.activeSeat !== seat && seat.item.title) {
44
44
  this.activeSeat = seat;
45
45
  this.setTitle(seat.item.title.split("\n"));
46
46
  this.title.generateTitle();
@@ -79,6 +79,7 @@ export default class Tooltip extends SvgBase {
79
79
  this.parent.node.on("mousemove.seat", function () {
80
80
  if (_self.global.multi_select) return;
81
81
  if (_self.global.zoomManager.zoomLevel === ZoomLevel.SEAT && _self.activeSeat !== null) {
82
+ // @ts-ignore
82
83
  let cor = d3Mouse(this);
83
84
 
84
85
  let x = cor[0] - (_self.global.config.tooltip_style.width / 2);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * $project.fileName
3
- * https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
3
+ * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
4
  */
5
5
 
6
6
 
@@ -24,7 +24,7 @@ export default class ZoomOutBg extends SvgBase {
24
24
  .attr("width", win.width)
25
25
  .attr("height", win.height)
26
26
  .on("click.zoomout", () => {
27
- this.global.eventManager.dispatch(EventType.CLICK_ZOOMOUT, this);
27
+ this.global.eventManager.dispatch(EventType.CLICK_ZOOM_OUT, this);
28
28
  });
29
29
  })
30
30
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * $project.fileName
3
- * https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
3
+ * https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
4
4
  */
5
5
 
6
6
  import {mouse as d3Mouse, event as d3Event} from 'd3-selection'
@@ -49,20 +49,19 @@ export default class ZoomManager {
49
49
  };
50
50
 
51
51
  public activeBlocks: Array<any>;
52
- public minZoom: number = null;
53
- private _zoomLevel: ZoomLevel;
52
+ public minZoom: number | null = null;
53
+ public zoomLevel: ZoomLevel;
54
54
 
55
55
 
56
56
  constructor(private _self: SeatMapCanvas) {
57
-
58
57
  this.activeBlocks = [];
59
58
  this.zoomLevel = ZoomLevel.VENUE;
60
-
61
59
  this.dispatchZoomEvent();
62
60
  }
63
61
 
64
62
  public init() {
65
63
 
64
+ console.log('zoom init')
66
65
  this.calculateZoomLevels();
67
66
  this.zoomInit();
68
67
  // this._self.eventManager.addEventListener(EventType.UPDATE_BLOCK, (blocks: Array<BlockModel>) => {
@@ -85,6 +84,7 @@ export default class ZoomManager {
85
84
  }
86
85
 
87
86
  zoomInit() {
87
+ console.info('zoomInit')
88
88
  this.zoomTypes.normal = d3Zoom()
89
89
  .scaleExtent([this._self.config.min_zoom, this._self.config.max_zoom])
90
90
  .on("end", this.zoomEnd(this))
@@ -104,6 +104,7 @@ export default class ZoomManager {
104
104
  }
105
105
 
106
106
  zoomEnd(_self: this): any {
107
+ console.info('zoomEnd')
107
108
  return function () {
108
109
  let x = d3Event.transform.x;
109
110
  let y = d3Event.transform.y;
@@ -111,11 +112,12 @@ export default class ZoomManager {
111
112
  _self._self.svg.stage.node.interrupt().attr("transform", "translate(" + x + "," + y + ")scale(" + k + ")");
112
113
  _self.calculateActiveBlocks();
113
114
  _self.calculateZoomLevel(k);
114
- _self.canvasScopeHandler();
115
+ // _self.canvasScopeHandler();
115
116
  }
116
117
  }
117
118
 
118
119
  animatedZoomEnd(_self: this): any {
120
+ console.info('animatedZoomEnd')
119
121
  return function () {
120
122
  let x = d3Event.transform.x;
121
123
  let y = d3Event.transform.y;
@@ -127,6 +129,7 @@ export default class ZoomManager {
127
129
  }
128
130
 
129
131
  animatedFastZoomEnd(_self: this): any {
132
+ console.info('animatedFastZoomEnd')
130
133
  return function () {
131
134
  let x = d3Event.transform.x;
132
135
  let y = d3Event.transform.y;
@@ -138,6 +141,7 @@ export default class ZoomManager {
138
141
  }
139
142
 
140
143
  zoomHand(_self: this): any {
144
+ console.info('zoomHand')
141
145
  return function () {
142
146
  let x = d3Event.transform.x;
143
147
  let y = d3Event.transform.y;
@@ -148,6 +152,7 @@ export default class ZoomManager {
148
152
  }
149
153
 
150
154
  zoomHandAnimated(_self: this): any {
155
+ console.info('zoomHandAnimated')
151
156
  return function () {
152
157
  let x = d3Event.transform.x;
153
158
  let y = d3Event.transform.y;
@@ -159,6 +164,7 @@ export default class ZoomManager {
159
164
  }
160
165
 
161
166
  zoomHandFastAnimated(_self: this): any {
167
+ console.info('zoomHandFastAnimated')
162
168
  return function () {
163
169
  let x = d3Event.transform.x;
164
170
  let y = d3Event.transform.y;
@@ -170,13 +176,14 @@ export default class ZoomManager {
170
176
  }
171
177
 
172
178
  calculateZoomLevel(k: number) {
179
+ console.info('calculateZoomLevel')
173
180
  let _levels = {
174
181
  seat: this._self.config.max_zoom - 0.2,
175
182
  block: this.zoomLevels.BLOCK.k,
176
183
  venue: this.zoomLevels.VENUE.k
177
184
  };
178
185
 
179
- let _zoomLevel = null;
186
+ let _zoomLevel: ZoomLevel | null = null;
180
187
 
181
188
  let blocks_count = this._self.data.getBlocks().length;
182
189
 
@@ -191,7 +198,7 @@ export default class ZoomManager {
191
198
  }
192
199
 
193
200
  if (_zoomLevel !== this.zoomLevel) {
194
- this.zoomLevel = _zoomLevel;
201
+ this.zoomLevel = _zoomLevel as ZoomLevel;
195
202
  this.dispatchZoomEvent();
196
203
  }
197
204
  }
@@ -216,6 +223,7 @@ export default class ZoomManager {
216
223
 
217
224
  public calculateZoomLevels(blocks: Array<BlockModel> = this._self.data.getBlocks()): this {
218
225
 
226
+ console.info('calculateZoomLevels')
219
227
  let _wm = this._self.windowManager;
220
228
  let _stage = _wm.stage;
221
229
 
@@ -241,8 +249,11 @@ export default class ZoomManager {
241
249
 
242
250
  });
243
251
 
244
- this.scale.x = (_wm.width / _stage.width) - ((_wm.width / _stage.width) / 5);
245
- this.scale.y = (_wm.height / _stage.height) - ((_wm.height / _stage.height) / 5);
252
+ if (_wm.width && _wm.height) {
253
+ this.scale.x = (_wm.width / _stage.width) - ((_wm.width / _stage.width) / 5);
254
+ this.scale.y = (_wm.height / _stage.height) - ((_wm.height / _stage.height) / 5);
255
+ }
256
+
246
257
  this.scale.k = (this.scale.x < this.scale.y) ? this.scale.x : this.scale.y;
247
258
  this.minZoom = this.scale.k < 1 ? this.scale.k : 1;
248
259
 
@@ -272,40 +283,46 @@ export default class ZoomManager {
272
283
  blocks.map((block: BlockModel) => {
273
284
  let _block_item = this._self.svg.stage.blocks.getBlock(block.id);
274
285
 
286
+ if (_block_item) {
287
+ let bound = _block_item.node.node().getBoundingClientRect();
288
+ let bbox = _block_item.node.node().getBBox();
275
289
 
276
- let bound = _block_item.node.node().getBoundingClientRect();
277
- let bbox = _block_item.node.node().getBBox();
290
+ block.bbox = bbox;
278
291
 
279
- block.bbox = bbox;
292
+ if (this._self.windowManager.width && this._self.windowManager.height) {
293
+ let x = (this._self.windowManager.width / bbox.width) - ((this._self.windowManager.width / bbox.width) / 3);
294
+ let y = (this._self.windowManager.height / bbox.height) - ((this._self.windowManager.height / bbox.height) / 3);
295
+ let k = (x < y) ? x : y;
280
296
 
281
- let x = (this._self.windowManager.width / bbox.width) - ((this._self.windowManager.width / bbox.width) / 3);
282
- let y = (this._self.windowManager.height / bbox.height) - ((this._self.windowManager.height / bbox.height) / 3);
283
- let k = (x < y) ? x : y;
297
+ x += bbox.x + (bbox.width / 2);
298
+ y += bbox.y + (bbox.height / 2);
284
299
 
285
- x += bbox.x + (bbox.width / 2);
286
- y += bbox.y + (bbox.height / 2);
300
+ k = k > this._self.config.max_zoom ? this._self.config.max_zoom : k;
287
301
 
288
- k = k > this._self.config.max_zoom ? this._self.config.max_zoom : k;
302
+ block.zoom_bbox = {
303
+ x: x,
304
+ y: y,
305
+ k: k
306
+ };
289
307
 
290
- block.zoom_bbox = {
291
- x: x,
292
- y: y,
293
- k: k
294
- };
295
308
 
309
+ let x_overlap = Math.max(0, Math.min(this._self.windowManager.width, bound.right) - Math.max(0, bound.left));
310
+ let y_overlap = Math.max(0, Math.min(this._self.windowManager.height, bound.bottom) - Math.max(0, bound.top));
311
+ let overlapArea = (x_overlap * y_overlap);
312
+ let allOverlapArea = this._self.windowManager.width * this._self.windowManager.height;
313
+ let ratio: number = (overlapArea * 100) / allOverlapArea;
296
314
 
297
- let x_overlap = Math.max(0, Math.min(this._self.windowManager.width, bound.right) - Math.max(0, bound.left));
298
- let y_overlap = Math.max(0, Math.min(this._self.windowManager.height, bound.bottom) - Math.max(0, bound.top));
299
- let overlapArea = (x_overlap * y_overlap);
300
- let allOverlapArea = this._self.windowManager.width * this._self.windowManager.height;
301
- let ratio: number = (overlapArea * 100) / allOverlapArea;
315
+ if (overlapArea > 0) {
302
316
 
303
- if (overlapArea > 0) {
304
- this.activeBlocks.push({
305
- block: _block_item,
306
- ratio: Number(ratio.toFixed(2))
307
- });
317
+ this.activeBlocks.push({
318
+ block: _block_item,
319
+ ratio: Number(ratio.toFixed(2))
320
+ });
321
+ }
322
+ }
308
323
  }
324
+
325
+
309
326
  });
310
327
 
311
328
  this.activeBlocks = this.activeBlocks.sort((a, b) => b.ratio - a.ratio);
@@ -341,9 +358,7 @@ export default class ZoomManager {
341
358
  }
342
359
 
343
360
  public zoomToBlock(id: string | number, animation: boolean = true, fastAnimated: boolean = false) {
344
- let _block = this._self.data.getBlocks().find((block: BlockModel) => block.id === id);
345
-
346
-
361
+ let _block = this._self.data.getBlocks().find((block) => block.id.toString() === id.toString());
347
362
  if (_block) {
348
363
  if (animation) {
349
364
  if (fastAnimated) {
@@ -370,6 +385,7 @@ export default class ZoomManager {
370
385
 
371
386
  public zoomToVenue(animation: boolean = true, fastAnimated: boolean = false) {
372
387
 
388
+ console.info('zoomToVenue')
373
389
  let x = this.zoomLevels.VENUE.x;
374
390
  let y = this.zoomLevels.VENUE.y;
375
391
  let k = this.zoomLevels.VENUE.k;
@@ -404,14 +420,6 @@ export default class ZoomManager {
404
420
  }
405
421
 
406
422
 
407
- get zoomLevel(): ZoomLevel {
408
- return this._zoomLevel;
409
- }
410
-
411
- set zoomLevel(value: ZoomLevel) {
412
- this._zoomLevel = value;
413
- }
414
-
415
423
  public zoomEnable(): this {
416
424
  this._self.svg.node.call(this.zoomTypes.normal);
417
425
  //this._self.svg.node.on('.zoom', null);
@@ -428,13 +436,13 @@ export default class ZoomManager {
428
436
  }
429
437
 
430
438
  public getActiveZoom() {
431
- return this.zoomLevels[this._zoomLevel];
439
+ return this.zoomLevels[this.zoomLevel];
432
440
  }
433
441
 
434
442
  private dispatchZoomEvent() {
435
443
  this._self.eventManager.dispatch(EventType.ZOOM_LEVEL_CHANGE, {
436
- level: this._zoomLevel,
437
- values: this.getZoomLevelValues(this._zoomLevel)
444
+ level: this.zoomLevel,
445
+ values: this.getZoomLevelValues(this.zoomLevel)
438
446
  });
439
447
  }
440
448
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Seatmap-canvas
3
- * https://github.com/seatmap/canvas Copyright 2022 Ali Sait TEKE
3
+ * https://github.com/alisaitteke/seatmap-canvas Copyright 2022 Ali Sait TEKE
4
4
  */
5
5
  import {select as d3Select} from 'd3-selection'
6
6
 
@@ -11,8 +11,8 @@ declare var window: any;
11
11
 
12
12
  export default class WindowManager {
13
13
 
14
- public width: number = null;
15
- public height: number = null;
14
+ public width: number | null = null;
15
+ public height: number | null = null;
16
16
 
17
17
  public stage: any = {
18
18
  width: null,
package/tsconfig.json CHANGED
@@ -1,28 +1,32 @@
1
1
  {
2
- "compileOnSave": false,
3
2
  "compilerOptions": {
3
+ "esModuleInterop": true,
4
+ "strict": true,
5
+ "skipLibCheck": true,
6
+ "jsx": "react",
7
+ "module": "ESNext",
4
8
  "baseUrl": "./",
5
- "module": "commonjs",
6
- "noImplicitAny": true,
7
- "removeComments": true,
8
- "preserveConstEnums": true,
9
- "outDir": "./buildc",
9
+ "declarationDir": "types",
10
10
  "sourceMap": true,
11
- "declaration": false,
11
+ "outDir": "dist",
12
12
  "moduleResolution": "node",
13
- "emitDecoratorMetadata": true,
13
+ "emitDeclarationOnly": true,
14
14
  "experimentalDecorators": true,
15
- "target": "es5",
15
+ "allowSyntheticDefaultImports": true,
16
+ "forceConsistentCasingInFileNames": true,
17
+ "emitDecoratorMetadata": true,
18
+ "strictPropertyInitialization": false,
19
+ "preserveConstEnums": true,
20
+ "declaration": true,
21
+ "noImplicitAny": true,
16
22
  "typeRoots": [
17
23
  "node_modules/@types"
18
- ],
19
- "lib": [
20
- "es2017",
21
- "es2015",
22
- "dom"
23
24
  ]
24
25
  },
25
- "files": [
26
- "src/lib/canvas.index.ts"
26
+ "exclude": [
27
+ "dist",
28
+ "node_modules",
29
+ "src/**/*.test.tsx",
30
+ "src/**/*.stories.tsx"
27
31
  ]
28
- }
32
+ }
@@ -1 +0,0 @@
1
- .multi-select-enable .seatmap-svg .stage .blocks .block{cursor:crosshair}.multi-select-enable .seatmap-svg .stage .blocks .block .masks .seat-level-mask{cursor:crosshair !important}.multi-select-enable .seatmap-svg .stage .blocks .block .seats .seat{cursor:crosshair}.multi-select-enable .seatmap-svg .stage .blocks .block .seats .seat.selected{cursor:crosshair}.seatmap-svg{position:relative;width:100%;height:100%}.seatmap-svg.zoom-level-SEAT .stage .blocks .block .masks .seat-level-mask{cursor:none}.seatmap-svg.zoom-level-BLOCK .stage .blocks .block .masks .seat-level-mask{cursor:none}.seatmap-svg.zoom-level-VENUE .stage .blocks .block .masks .seat-level-mask{cursor:none}.seatmap-svg .zoom-out-bg{cursor:zoom-out;fill:rgba(0,0,0,0)}.seatmap-svg .stage .blocks .block .bounds .block-hull-border{stroke-linejoin:round;opacity:.5}.seatmap-svg .stage .blocks .block .bounds .block-hull{stroke-linejoin:round;cursor:move}.seatmap-svg .stage .blocks .block .masks .venue-level-mask{transition-property:opacity;transition-duration:.5s;transition-delay:.2s;transition-timing-function:ease-in-out;stroke-linejoin:round;opacity:1}.seatmap-svg .stage .blocks .block .masks .block-level-mask{transition-property:opacity;transition-duration:.5s;transition-delay:.2s;transition-timing-function:ease-in-out;stroke-linejoin:round;opacity:1}.seatmap-svg .stage .blocks .block .masks .seat-level-mask{transition-property:opacity;transition-duration:.5s;transition-delay:.2s;transition-timing-function:ease-in-out;stroke-linejoin:round;opacity:0}.seatmap-svg .stage .blocks .block .masks .bound-hide{transition-property:opacity;transition-duration:.5s;transition-delay:.2s;transition-timing-function:ease-in-out;pointer-events:none;opacity:0}.seatmap-svg .stage .blocks .block .info .title{text-anchor:middle;dominant-baseline:central}.seatmap-svg .stage .blocks .block .seats .seat{cursor:copy}.seatmap-svg .stage .blocks .block .seats .seat.selected{cursor:pointer}.seatmap-svg .stage .blocks .block .seats .seat .label-text{text-anchor:middle;dominant-baseline:central}.seatmap-svg .stage .blocks .block .labels .label circle{stroke:rgba(0,0,0,.2)}.seatmap-svg .stage .blocks .block .labels .label .label-text{text-anchor:middle;dominant-baseline:central}.seatmap-svg .stage .blocks .block .zoom-layers-container .zoom-layer-hull{stroke-width:80px;stroke-linejoin:round}@media(any-pointer: coarse){.seatmap-svg .stage .blocks .search-circle{display:none}}.seatmap-svg .stage .search-circle{opacity:0;transition-property:opacity;transition-duration:.2s;transition-delay:0;transition-timing-function:ease-in-out}.seatmap-svg .stage .search-circle .circle{fill:rgba(0,0,0,0);pointer-events:none;stroke:rgba(0,0,0,.4);stroke-width:4px}.seatmap-svg .stage .search-circle.hide{transition-property:opacity;transition-duration:.2s;transition-delay:0;transition-timing-function:ease-in-out;opacity:0}.seatmap-svg .stage .search-circle.show{transition-property:opacity;transition-duration:.2s;transition-delay:0;transition-timing-function:ease-in-out;opacity:1}.seatmap-svg .legend .legend-item circle{stroke:#adadad;stroke-width:1px}.seatmap-svg .legend .legend-item text{text-anchor:start;dominant-baseline:central}