Skip to content

Commit

Permalink
feat(svg): add new seat SVG asset and custom seat item classes
Browse files Browse the repository at this point in the history
Add seat-1.svg to provide a visual representation of a seat.
Introduce SeatItemCheck and SeatItemCircle classes to enhance
customization and interaction with seat elements in the SVG stage.
  • Loading branch information
alisaitteke committed Jan 29, 2025
1 parent 4b86282 commit a446e5d
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/assets/seat-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
45 changes: 45 additions & 0 deletions src/lib/svg/stage/blocks/block-item/seat/seat-item.custom-check.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* $project.fileName
* https://github.com/seatmap/canvas Copyright 2018 Ali Sait TEKE
*/

import SvgBase from "@svg/svg.base";
import {dom} from "@decorator/dom";
import {SeatItem} from "@svg/stage/blocks/block-item/seat/seat-item.index";

@dom({
tag: "path",
class: "seat-check",
autoGenerate: false
})
export class SeatItemCheck extends SvgBase {

constructor(public parent: SeatItem) {
super(parent);
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");
this.attr("fill", this.global.config.style.seat.check_color);
this.attr("transform", "translate(-8,-959.36218)");
this.attr("pointer-events", "none");
this.attr("display", "none");

return this;
}

update(): this {
return this;
}

afterGenerate() {
this.node.style("pointer-events", "none");
}

show():this {
this.node.attr("display", "block");
return this;
}

hide():this {
this.node.attr("display", "none");
return this;
}
}
31 changes: 31 additions & 0 deletions src/lib/svg/stage/blocks/block-item/seat/seat-item.custom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* $project.fileName
* https://github.com/alisaitteke/seatmap-canvas Copyright 2023 Ali Sait TEKE
*/

import SvgBase from "@svg/svg.base";

import {dom} from "@decorator/dom";
import {SeatItem} from "./seat-item.index";

@dom({
tag: "circle",
class: "seat-circle",
autoGenerate: false
})
export class SeatItemCircle extends SvgBase {

constructor(public parent: SeatItem) {
super(parent);
this.attr("block-id", parent.item.block.id);
this.attr("r", this.global.config.style.seat.radius);
this.attr("fill", this.global.config.style.seat.color);
this.attr("stroke", "rgba(0,0,0,0.3)");
this.attr("stroke-width", 1);
return this;
}

update(): this {
return this;
}
}

0 comments on commit a446e5d

Please sign in to comment.