Skip to content

Commit

Permalink
refactor(svg): remove unnecessary comments and metadata from SVG file…
Browse files Browse the repository at this point in the history
…s to reduce file size and improve readability

fix(example.js): update customSeatSvg path to use seat-2.svg for consistency with updated assets
fix(seat-item.custom-area.ts): adjust transform translate value to correct seat positioning
fix(seat-item.custom.ts): adjust transform translate value and add viewBox attribute for correct SVG rendering and positioning
  • Loading branch information
alisaitteke committed Jan 29, 2025
1 parent 61aa007 commit e37ef2e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 49 deletions.
3 changes: 1 addition & 2 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.
7 changes: 1 addition & 6 deletions examples/assets/seat-2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 19 additions & 25 deletions examples/assets/table.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 1 addition & 14 deletions examples/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,7 @@ $(document).ready(function () {
gapY: 80,
minItem: 100,
maxItem: 200,
customSeatSvg: 'assets/seat-1.svg',
seatRadius: 50,
cellMin: 8,
cellMax: 12,
blockGap: 100
},
{
title: 'Chair',
blockSize: 4,
gapX: 80,
gapY: 80,
minItem: 100,
maxItem: 200,
customSeatSvg: 'assets/seat-1.svg',
customSeatSvg: 'assets/seat-2.svg',
seatRadius: 50,
cellMin: 8,
cellMax: 12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SeatItemCustomSvgArea extends SvgBase {
this.attr("fill", this.global.config.style.label.color);
this.attr("opacity", 0);
this.attr("r", this.global.config.style.seat.radius / 1.5);
this.attr("transform", `translate(${(this.global.config.style.seat.radius / 2) },630)`);
this.attr("transform", `translate(${(this.global.config.style.seat.radius / 2) },500)`);

return this;
}
Expand Down
13 changes: 12 additions & 1 deletion src/lib/svg/stage/blocks/block-item/seat/seat-item.custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class SeatItemCustomSvg extends SvgBase {

constructor(public parent: SeatItem, public customSvg: any) {
super(parent);
this.attr("transform", `translate(${(this.global.config.style.seat.radius / 2) * -1},-630)`);
this.attr("transform", `translate(${(this.global.config.style.seat.radius / 2) * -1},-500)`);
return this;
}

Expand All @@ -33,7 +33,18 @@ export class SeatItemCustomSvg extends SvgBase {
super.domGenerate(to, index);
const importedSVG = select(this.customSvg.documentElement.cloneNode(true));
importedSVG.attr('width', this.global.config.style.seat.radius)
importedSVG.attr('viewBox',`0 0 ${this.global.config.style.seat.radius} ${this.global.config.style.seat.radius}`)

this.node.node().append(importedSVG.node())


// const importedElements = Array.from(this.customSvg.documentElement.cloneNode(true).children);
// console.log('importedElements',importedElements)
//
// importedElements.forEach(element => {
// this.node.node().appendChild(element); // Her bir öğeyi ekle
// });

this.addChild(new SeatItemCustomSvgArea(this))
return this

Expand Down

0 comments on commit e37ef2e

Please # to comment.