@alisaitteke/seatmap-canvas 2.1.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.
- package/CHANGELOG.md +5 -1
- package/LICENSE +1 -1
- package/README.md +18 -10
- package/dist/cjs/seatmap.canvas.css +151 -0
- package/dist/cjs/seatmap.canvas.js +40 -0
- package/dist/cjs/seatmap.canvas.js.map +1 -0
- package/dist/cjs/types/canvas.index.browser.d.ts +2 -0
- package/dist/cjs/types/canvas.index.d.ts +23 -0
- package/dist/cjs/types/config.d.ts +3 -0
- package/dist/cjs/types/decorators/dom.d.ts +8 -0
- package/dist/cjs/types/decorators/index.d.ts +1 -0
- package/dist/cjs/types/dev.tools.d.ts +6 -0
- package/{src/lib/enums/global.ts → dist/cjs/types/enums/global.d.ts} +6 -27
- package/dist/cjs/types/models/block.model.d.ts +29 -0
- package/dist/cjs/types/models/coordinate.model.d.ts +7 -0
- package/dist/cjs/types/models/data.model.d.ts +26 -0
- package/dist/cjs/types/models/defaults.model.d.ts +32 -0
- package/dist/cjs/types/models/global.model.d.ts +18 -0
- package/dist/cjs/types/models/label.model.d.ts +9 -0
- package/dist/cjs/types/models/legend.model.d.ts +8 -0
- package/dist/cjs/types/models/model.base.d.ts +5 -0
- package/dist/cjs/types/models/seat.model.d.ts +40 -0
- package/dist/cjs/types/models/styles/block.style.d.ts +7 -0
- package/dist/cjs/types/models/styles/label.style.d.ts +6 -0
- package/dist/cjs/types/models/styles/legend.style.d.ts +6 -0
- package/dist/cjs/types/models/styles/seat.style.d.ts +12 -0
- package/dist/cjs/types/models/styles/tooltip.style.d.ts +7 -0
- package/dist/cjs/types/svg/event.manager.d.ts +12 -0
- package/dist/cjs/types/svg/legend/legend.circle.d.ts +7 -0
- package/dist/cjs/types/svg/legend/legend.item.d.ts +13 -0
- package/dist/cjs/types/svg/legend/legend.title.d.ts +7 -0
- package/dist/cjs/types/svg/legend.d.ts +8 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/block-item.bounds.d.ts +12 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/block-item.index.d.ts +23 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/block-item.info.index.d.ts +11 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/block-item.labels.index.d.ts +11 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/block-item.mask.d.ts +12 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/block-item.seats.index.d.ts +15 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/bound/bound-item.index.d.ts +12 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/info/title.d.ts +7 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/label/label-item.circle.d.ts +7 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/label/label-item.index.d.ts +13 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/label/label-item.title.d.ts +7 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/seat/seat-item.check.d.ts +10 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/seat/seat-item.circle.d.ts +7 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/seat/seat-item.index.d.ts +28 -0
- package/dist/cjs/types/svg/stage/blocks/block-item/seat/seat-item.title.d.ts +7 -0
- package/dist/cjs/types/svg/stage/blocks/blocks.index.d.ts +13 -0
- package/dist/cjs/types/svg/stage/blocks.search-circle.d.ts +12 -0
- package/dist/cjs/types/svg/stage/multi-select/rect.d.ts +7 -0
- package/dist/cjs/types/svg/stage/multi-select.d.ts +13 -0
- package/dist/cjs/types/svg/stage/search-circle/circle.d.ts +7 -0
- package/dist/cjs/types/svg/stage/stage.index.d.ts +11 -0
- package/dist/cjs/types/svg/svg.base.d.ts +35 -0
- package/dist/cjs/types/svg/svg.index.d.ts +16 -0
- package/dist/cjs/types/svg/tooltip/rect.d.ts +8 -0
- package/dist/cjs/types/svg/tooltip/title.d.ts +10 -0
- package/dist/cjs/types/svg/tooltip.d.ts +15 -0
- package/dist/cjs/types/svg/zoom-out.bg.d.ts +7 -0
- package/dist/cjs/types/svg/zoom.manager.d.ts +41 -0
- package/dist/cjs/types/window.manager.d.ts +9 -0
- package/dist/dependencies.txt +849 -0
- package/dist/esm/seatmap.canvas.css +151 -0
- package/dist/esm/seatmap.canvas.js +16 -0
- package/dist/esm/seatmap.canvas.js.map +1 -0
- package/dist/esm/types/canvas.index.browser.d.ts +2 -0
- package/dist/esm/types/canvas.index.d.ts +23 -0
- package/dist/esm/types/config.d.ts +3 -0
- package/dist/esm/types/decorators/dom.d.ts +8 -0
- package/dist/esm/types/decorators/index.d.ts +1 -0
- package/dist/esm/types/dev.tools.d.ts +6 -0
- package/dist/esm/types/enums/global.d.ts +46 -0
- package/dist/esm/types/models/block.model.d.ts +29 -0
- package/dist/esm/types/models/coordinate.model.d.ts +7 -0
- package/dist/esm/types/models/data.model.d.ts +26 -0
- package/dist/esm/types/models/defaults.model.d.ts +32 -0
- package/dist/esm/types/models/global.model.d.ts +18 -0
- package/dist/esm/types/models/label.model.d.ts +9 -0
- package/dist/esm/types/models/legend.model.d.ts +8 -0
- package/dist/esm/types/models/model.base.d.ts +5 -0
- package/dist/esm/types/models/seat.model.d.ts +40 -0
- package/dist/esm/types/models/styles/block.style.d.ts +7 -0
- package/dist/esm/types/models/styles/label.style.d.ts +6 -0
- package/dist/esm/types/models/styles/legend.style.d.ts +6 -0
- package/dist/esm/types/models/styles/seat.style.d.ts +12 -0
- package/dist/esm/types/models/styles/tooltip.style.d.ts +7 -0
- package/dist/esm/types/svg/event.manager.d.ts +12 -0
- package/dist/esm/types/svg/legend/legend.circle.d.ts +7 -0
- package/dist/esm/types/svg/legend/legend.item.d.ts +13 -0
- package/dist/esm/types/svg/legend/legend.title.d.ts +7 -0
- package/dist/esm/types/svg/legend.d.ts +8 -0
- package/dist/esm/types/svg/stage/blocks/block-item/block-item.bounds.d.ts +12 -0
- package/dist/esm/types/svg/stage/blocks/block-item/block-item.index.d.ts +23 -0
- package/dist/esm/types/svg/stage/blocks/block-item/block-item.info.index.d.ts +11 -0
- package/dist/esm/types/svg/stage/blocks/block-item/block-item.labels.index.d.ts +11 -0
- package/dist/esm/types/svg/stage/blocks/block-item/block-item.mask.d.ts +12 -0
- package/dist/esm/types/svg/stage/blocks/block-item/block-item.seats.index.d.ts +15 -0
- package/dist/esm/types/svg/stage/blocks/block-item/bound/bound-item.index.d.ts +12 -0
- package/dist/esm/types/svg/stage/blocks/block-item/info/title.d.ts +7 -0
- package/dist/esm/types/svg/stage/blocks/block-item/label/label-item.circle.d.ts +7 -0
- package/dist/esm/types/svg/stage/blocks/block-item/label/label-item.index.d.ts +13 -0
- package/dist/esm/types/svg/stage/blocks/block-item/label/label-item.title.d.ts +7 -0
- package/dist/esm/types/svg/stage/blocks/block-item/seat/seat-item.check.d.ts +10 -0
- package/dist/esm/types/svg/stage/blocks/block-item/seat/seat-item.circle.d.ts +7 -0
- package/dist/esm/types/svg/stage/blocks/block-item/seat/seat-item.index.d.ts +28 -0
- package/dist/esm/types/svg/stage/blocks/block-item/seat/seat-item.title.d.ts +7 -0
- package/dist/esm/types/svg/stage/blocks/blocks.index.d.ts +13 -0
- package/dist/esm/types/svg/stage/blocks.search-circle.d.ts +12 -0
- package/dist/esm/types/svg/stage/multi-select/rect.d.ts +7 -0
- package/dist/esm/types/svg/stage/multi-select.d.ts +13 -0
- package/dist/esm/types/svg/stage/search-circle/circle.d.ts +7 -0
- package/dist/esm/types/svg/stage/stage.index.d.ts +11 -0
- package/dist/esm/types/svg/svg.base.d.ts +35 -0
- package/dist/esm/types/svg/svg.index.d.ts +16 -0
- package/dist/esm/types/svg/tooltip/rect.d.ts +8 -0
- package/dist/esm/types/svg/tooltip/title.d.ts +10 -0
- package/dist/esm/types/svg/tooltip.d.ts +15 -0
- package/dist/esm/types/svg/zoom-out.bg.d.ts +7 -0
- package/dist/esm/types/svg/zoom.manager.d.ts +41 -0
- package/dist/esm/types/window.manager.d.ts +9 -0
- package/dist/types.d.ts +533 -0
- package/package.json +25 -22
- package/.eslintrc.json +0 -15
- package/.github/FUNDING.yml +0 -4
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/workflows/codeql-analysis.yml +0 -29
- package/.github/workflows/npm-publish-packages.yml +0 -35
- package/.github/workflows/publish.yml +0 -103
- package/.github/workflows/webpack.yml +0 -22
- package/.opencommitignore +0 -4
- package/AUTHORS +0 -3
- package/SECURITY.md +0 -21
- package/_config.yml +0 -1
- package/assets/banner_ui.png +0 -0
- package/assets/bn.jpg +0 -0
- package/assets/logo.jpg +0 -0
- package/assets/logo_small.jpg +0 -0
- package/assets/zoom_out.svg +0 -11
- package/cog.toml +0 -19
- package/dist/seatmap.canvas.2.0.1-0.css +0 -1
- package/dist/seatmap.canvas.2.0.1-0.js +0 -2
- package/dist/seatmap.canvas.2.0.1-0.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/src/lib/canvas.index.ts +0 -122
- package/src/lib/config.ts +0 -11
- package/src/lib/decorators/dom.ts +0 -40
- package/src/lib/decorators/index.ts +0 -6
- package/src/lib/dev.tools.ts +0 -18
- package/src/lib/models/block.model.ts +0 -170
- package/src/lib/models/coordinate.model.ts +0 -43
- package/src/lib/models/data.model.ts +0 -105
- package/src/lib/models/defaults.model.ts +0 -125
- package/src/lib/models/global.model.ts +0 -24
- package/src/lib/models/label.model.ts +0 -58
- package/src/lib/models/legend.model.ts +0 -56
- package/src/lib/models/model.base.ts +0 -32
- package/src/lib/models/seat.model.ts +0 -182
- package/src/lib/svg/event.manager.ts +0 -56
- package/src/lib/svg/legend/legend.circle.ts +0 -28
- package/src/lib/svg/legend/legend.item.ts +0 -50
- package/src/lib/svg/legend/legend.title.ts +0 -27
- package/src/lib/svg/legend.ts +0 -55
- package/src/lib/svg/stage/blocks/block-item/block-item.bounds.ts +0 -51
- package/src/lib/svg/stage/blocks/block-item/block-item.index.ts +0 -173
- package/src/lib/svg/stage/blocks/block-item/block-item.info.index.ts +0 -38
- package/src/lib/svg/stage/blocks/block-item/block-item.labels.index.ts +0 -41
- package/src/lib/svg/stage/blocks/block-item/block-item.mask.ts +0 -67
- package/src/lib/svg/stage/blocks/block-item/block-item.seats.index.ts +0 -81
- package/src/lib/svg/stage/blocks/block-item/bound/bound-item.index.ts +0 -43
- package/src/lib/svg/stage/blocks/block-item/info/title.ts +0 -30
- package/src/lib/svg/stage/blocks/block-item/label/label-item.circle.ts +0 -27
- package/src/lib/svg/stage/blocks/block-item/label/label-item.index.ts +0 -46
- package/src/lib/svg/stage/blocks/block-item/label/label-item.title.ts +0 -27
- package/src/lib/svg/stage/blocks/block-item/seat/seat-item.check.ts +0 -45
- package/src/lib/svg/stage/blocks/block-item/seat/seat-item.circle.ts +0 -30
- package/src/lib/svg/stage/blocks/block-item/seat/seat-item.index.ts +0 -159
- package/src/lib/svg/stage/blocks/block-item/seat/seat-item.title.ts +0 -27
- package/src/lib/svg/stage/blocks/blocks.index.ts +0 -68
- package/src/lib/svg/stage/blocks.search-circle.ts +0 -86
- package/src/lib/svg/stage/multi-select/rect.ts +0 -36
- package/src/lib/svg/stage/multi-select.ts +0 -107
- package/src/lib/svg/stage/search-circle/circle.ts +0 -37
- package/src/lib/svg/stage/stage.index.ts +0 -41
- package/src/lib/svg/svg.base.ts +0 -217
- package/src/lib/svg/svg.index.ts +0 -76
- package/src/lib/svg/tooltip/rect.ts +0 -66
- package/src/lib/svg/tooltip/title.ts +0 -57
- package/src/lib/svg/tooltip.ts +0 -92
- package/src/lib/svg/zoom-out.bg.ts +0 -35
- package/src/lib/svg/zoom.manager.ts +0 -440
- package/src/lib/window.manager.ts +0 -40
- package/src/scss/lib.scss +0 -10
- package/src/scss/style.scss +0 -221
- package/tsconfig.json +0 -28
- package/webpack.environments/development.js +0 -58
- package/webpack.environments/production.js +0 -52
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 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/seatmap/canvas Copyright 2018 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/seatmap/canvas Copyright 2018 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/seatmap/canvas Copyright 2018 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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import SvgBase from "../../../../svg.base";
|
|
7
|
-
import {dom} from "../../../../../decorators/dom";
|
|
8
|
-
import {LabelItem} from "./label-item.index";
|
|
9
|
-
|
|
10
|
-
@dom({
|
|
11
|
-
tag: "circle",
|
|
12
|
-
class: "label-circle",
|
|
13
|
-
autoGenerate: false
|
|
14
|
-
})
|
|
15
|
-
export class LabelItemCircle extends SvgBase {
|
|
16
|
-
|
|
17
|
-
constructor(public parent: LabelItem) {
|
|
18
|
-
super(parent);
|
|
19
|
-
this.attr("r", this.global.config.label_style.radius);
|
|
20
|
-
this.attr("fill", this.global.config.label_style.bg);
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
update(): this {
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import SvgBase from "../../../../svg.base";
|
|
8
|
-
import {dom} from "../../../../../decorators/dom";
|
|
9
|
-
import {LabelItemCircle} from "./label-item.circle";
|
|
10
|
-
import {CoordinateModel} from "../../../../../models/coordinate.model";
|
|
11
|
-
import Labels from "../block-item.labels.index";
|
|
12
|
-
import LabelModel from "../../../../../models/label.model";
|
|
13
|
-
import {LabelItemTitle} from "./label-item.title";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@dom({
|
|
17
|
-
tag: "g",
|
|
18
|
-
class: "label",
|
|
19
|
-
autoGenerate: false
|
|
20
|
-
})
|
|
21
|
-
export class LabelItem extends SvgBase {
|
|
22
|
-
|
|
23
|
-
public circle: LabelItemCircle;
|
|
24
|
-
public coordinates: CoordinateModel;
|
|
25
|
-
|
|
26
|
-
constructor(public parent: Labels, public item: LabelModel) {
|
|
27
|
-
super(parent);
|
|
28
|
-
this.coordinates = new CoordinateModel(item);
|
|
29
|
-
this.attr("transform", "translate(" + this.coordinates.toArray() + ")");
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
update(): this {
|
|
35
|
-
this.circle = new LabelItemCircle(this);
|
|
36
|
-
this.addChild(this.circle);
|
|
37
|
-
|
|
38
|
-
this.circle = new LabelItemTitle(this);
|
|
39
|
-
this.addChild(this.circle);
|
|
40
|
-
|
|
41
|
-
this.updateChilds();
|
|
42
|
-
|
|
43
|
-
this.circle.node.text(this.item.title);
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import SvgBase from "../../../../svg.base";
|
|
7
|
-
import {dom} from "../../../../../decorators/dom";
|
|
8
|
-
import {LabelItem} from "./label-item.index";
|
|
9
|
-
|
|
10
|
-
@dom({
|
|
11
|
-
tag: "text",
|
|
12
|
-
class: "label-text",
|
|
13
|
-
autoGenerate: false
|
|
14
|
-
})
|
|
15
|
-
export class LabelItemTitle extends SvgBase {
|
|
16
|
-
|
|
17
|
-
constructor(public parent: LabelItem) {
|
|
18
|
-
super(parent);
|
|
19
|
-
this.attr("fill", this.global.config.label_style.color);
|
|
20
|
-
this.attr("font-size", this.global.config.label_style.font_size);
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
update(): this {
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import SvgBase from "../../../../svg.base";
|
|
7
|
-
import {dom} from "../../../../../decorators/dom";
|
|
8
|
-
import {SeatItem} from "./seat-item.index";
|
|
9
|
-
|
|
10
|
-
@dom({
|
|
11
|
-
tag: "path",
|
|
12
|
-
class: "seat-check",
|
|
13
|
-
autoGenerate: false
|
|
14
|
-
})
|
|
15
|
-
export class SeatItemCheck extends SvgBase {
|
|
16
|
-
|
|
17
|
-
constructor(public parent: SeatItem) {
|
|
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.attr("fill", this.global.config.seat_style.check_color);
|
|
21
|
-
this.attr("transform", "translate(-8,-959.36218)");
|
|
22
|
-
this.attr("pointer-events", "none");
|
|
23
|
-
this.attr("display", "none");
|
|
24
|
-
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
update(): this {
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
afterGenerate() {
|
|
33
|
-
this.node.style("pointer-events", "none");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
show():this {
|
|
37
|
-
this.node.attr("display", "block");
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
hide():this {
|
|
42
|
-
this.node.attr("display", "none");
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import SvgBase from "../../../../svg.base";
|
|
7
|
-
import {dom} from "../../../../../decorators/dom";
|
|
8
|
-
import {SeatItem} from "./seat-item.index";
|
|
9
|
-
|
|
10
|
-
@dom({
|
|
11
|
-
tag: "circle",
|
|
12
|
-
class: "seat-circle",
|
|
13
|
-
autoGenerate: false
|
|
14
|
-
})
|
|
15
|
-
export class SeatItemCircle extends SvgBase {
|
|
16
|
-
|
|
17
|
-
constructor(public parent: SeatItem) {
|
|
18
|
-
super(parent);
|
|
19
|
-
this.attr("block-id", parent.item.block.id);
|
|
20
|
-
this.attr("r", this.global.config.seat_style.radius);
|
|
21
|
-
this.attr("fill", this.global.config.seat_style.color);
|
|
22
|
-
this.attr("stroke", "rgba(0,0,0,0.3)");
|
|
23
|
-
this.attr("stroke-width", 1);
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
update(): this {
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import SvgBase from "../../../../svg.base";
|
|
8
|
-
import {dom} from "../../../../../decorators/dom";
|
|
9
|
-
import SeatModel from "../../../../../models/seat.model";
|
|
10
|
-
import Seats from "../block-item.seats.index";
|
|
11
|
-
import {SeatItemCircle} from "./seat-item.circle";
|
|
12
|
-
import {CoordinateModel} from "../../../../../models/coordinate.model";
|
|
13
|
-
import {SeatItemTitle} from "./seat-item.title";
|
|
14
|
-
import {SeatAction} from "../../../../../enums/global";
|
|
15
|
-
import {SeatItemCheck} from "./seat-item.check";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@dom({
|
|
19
|
-
tag: "g",
|
|
20
|
-
class: "seat",
|
|
21
|
-
autoGenerate: false
|
|
22
|
-
})
|
|
23
|
-
export class SeatItem extends SvgBase {
|
|
24
|
-
|
|
25
|
-
public circle: SeatItemCircle;
|
|
26
|
-
public title: SeatItemTitle;
|
|
27
|
-
public coordinates: CoordinateModel;
|
|
28
|
-
public check: SeatItemCheck;
|
|
29
|
-
|
|
30
|
-
constructor(public parent: Seats, public item: SeatModel) {
|
|
31
|
-
super(parent);
|
|
32
|
-
this.coordinates = new CoordinateModel(item);
|
|
33
|
-
this.attr("transform", "translate(" + this.coordinates.toArray() + ")");
|
|
34
|
-
this.item.svg = this;
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public setColor(color: string, animation: boolean = false): this {
|
|
39
|
-
if (animation) {
|
|
40
|
-
this.circle.node.transition().duration(this.global.config.animation_speed).attr("fill", color);
|
|
41
|
-
} else {
|
|
42
|
-
this.circle.node.attr("fill", color);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public updateColor(color: string = null): this {
|
|
49
|
-
this.setColor(this.getColor());
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public select(color: string = null): this {
|
|
54
|
-
this.item.selected = true;
|
|
55
|
-
this.node.classed("selected", true);
|
|
56
|
-
this.circle.node.attr("fill", this.global.config.seat_style.selected);
|
|
57
|
-
this.check.show();
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public unSelect(): this {
|
|
62
|
-
this.item.selected = false;
|
|
63
|
-
this.node.classed("selected", false);
|
|
64
|
-
this.circle.node.attr("fill", this.global.config.seat_style.color);
|
|
65
|
-
this.check.hide();
|
|
66
|
-
return this;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public isSelected(): Boolean {
|
|
70
|
-
return this.item.selected;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public isSalable(): Boolean {
|
|
74
|
-
return this.item.salable;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public hover() {
|
|
78
|
-
this.setColor(this.global.config.seat_style.hover);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public blur() {
|
|
82
|
-
this.setColor(this.getColor());
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public getColor(action: SeatAction = null): string {
|
|
86
|
-
|
|
87
|
-
if (this.isSalable()) {
|
|
88
|
-
|
|
89
|
-
if (action == SeatAction.FOCUS) {
|
|
90
|
-
if (this.isSelected()) {
|
|
91
|
-
return this.global.config.seat_style.focus_out;
|
|
92
|
-
} else {
|
|
93
|
-
return this.global.config.seat_style.focus;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
} else if (action == SeatAction.HOVER) {
|
|
97
|
-
if (this.isSelected()) {
|
|
98
|
-
return this.global.config.seat_style.selected;
|
|
99
|
-
} else {
|
|
100
|
-
return this.global.config.seat_style.hover;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else if (action == SeatAction.LEAVE) {
|
|
104
|
-
if (this.isSelected()) {
|
|
105
|
-
return this.global.config.seat_style.selected;
|
|
106
|
-
} else {
|
|
107
|
-
return this.global.config.seat_style.color;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else if (action == SeatAction.SELECT) {
|
|
111
|
-
if (this.isSelected()) {
|
|
112
|
-
return this.global.config.seat_style.selected;
|
|
113
|
-
} else {
|
|
114
|
-
return this.global.config.seat_style.selected;
|
|
115
|
-
}
|
|
116
|
-
} else {
|
|
117
|
-
if (this.isSelected()) {
|
|
118
|
-
return this.global.config.seat_style.selected;
|
|
119
|
-
} else {
|
|
120
|
-
return this.global.config.seat_style.color;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
} else {
|
|
125
|
-
return this.global.config.seat_style.not_salable;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
update(): this {
|
|
131
|
-
this.circle = new SeatItemCircle(this);
|
|
132
|
-
this.addChild(this.circle);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.check = new SeatItemCheck(this).addTo(this);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
// this.title = new SeatItemTitle(this);
|
|
140
|
-
// this.addChild(this.title);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.updateChilds();
|
|
144
|
-
|
|
145
|
-
//this.title.node.text(this.item.title);
|
|
146
|
-
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
afterGenerate(){
|
|
151
|
-
this.setColor(this.getColor());
|
|
152
|
-
if(this.item.selected){
|
|
153
|
-
this.check.show()
|
|
154
|
-
}else{
|
|
155
|
-
this.check.hide()
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* $project.fileName
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import SvgBase from "../../../../svg.base";
|
|
7
|
-
import {dom} from "../../../../../decorators/dom";
|
|
8
|
-
import {SeatItem} from "./seat-item.index";
|
|
9
|
-
|
|
10
|
-
@dom({
|
|
11
|
-
tag: "text",
|
|
12
|
-
class: "label-text",
|
|
13
|
-
autoGenerate: false
|
|
14
|
-
})
|
|
15
|
-
export class SeatItemTitle extends SvgBase {
|
|
16
|
-
|
|
17
|
-
constructor(public parent: SeatItem) {
|
|
18
|
-
super(parent);
|
|
19
|
-
this.attr("fill", this.global.config.label_style.color);
|
|
20
|
-
this.attr("font-size", 10);
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
update(): this {
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* blocks.ts
|
|
3
|
-
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import {polygonHull} from 'd3-polygon'
|
|
7
|
-
|
|
8
|
-
import StageManager from "../stage.index";
|
|
9
|
-
import Block from "./block-item/block-item.index";
|
|
10
|
-
import SvgBase from "../../svg.base";
|
|
11
|
-
import {dom} from "../../../decorators/dom";
|
|
12
|
-
import SeatModel from "../../../models/seat.model";
|
|
13
|
-
import {SeatItem} from "./block-item/seat/seat-item.index";
|
|
14
|
-
import BlockModel from "../../../models/block.model";
|
|
15
|
-
import LabelModel from "../../../models/label.model";
|
|
16
|
-
|
|
17
|
-
@dom({
|
|
18
|
-
tag: "g",
|
|
19
|
-
class: "blocks",
|
|
20
|
-
autoGenerate: false
|
|
21
|
-
})
|
|
22
|
-
export default class Blocks extends SvgBase {
|
|
23
|
-
|
|
24
|
-
public seats: Array<SeatItem>;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
constructor(public parent: StageManager) {
|
|
28
|
-
super(parent);
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public update(): this {
|
|
33
|
-
this.clear();
|
|
34
|
-
this.global.data.getBlocks().map((block_item: BlockModel) => {
|
|
35
|
-
let _blockItem = new Block(this, block_item);
|
|
36
|
-
let _seats = block_item.seats;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// algorithm problem fixed
|
|
40
|
-
if (_seats && _seats.length) {
|
|
41
|
-
_seats[0].y += 0.0001;
|
|
42
|
-
_seats[0].x += 0.0001;
|
|
43
|
-
}
|
|
44
|
-
|
|
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
|
-
let _bounds = polygonHull(bound_items);
|
|
47
|
-
block_item.bounds = _bounds;
|
|
48
|
-
|
|
49
|
-
this.addChild(_blockItem);
|
|
50
|
-
});
|
|
51
|
-
this.updateChilds();
|
|
52
|
-
this.seats = this.node.selectAll(".seat");
|
|
53
|
-
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public getBlock(id: any): Block {
|
|
58
|
-
return this.getBlocks().find((block: Block) => block.item.id == id);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public getBlocks(): Array<Block> {
|
|
62
|
-
return this.getChilds(Block.name);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public center() {
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
}
|