Skip to content

Commit

Permalink
Add pami
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottvantorre authored and gdepuille committed May 7, 2024
1 parent 7410b18 commit 2a278de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/app/components/map/input/map-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export class MapInputComponent extends AbstractComponent implements OnChanges, O
this.robots['nerell'] = this.buildRobot('nerell');
this.mainLayer.add(this.robots['nerell']);

this.robots['pami △'] = this.buildRobot('pami △');
this.mainLayer.add(this.robots['pami △']);

this.points = new Konva.Group();
this.mainLayer.add(this.points);

Expand Down Expand Up @@ -407,24 +410,32 @@ export class MapInputComponent extends AbstractComponent implements OnChanges, O
visible: false,
});

const isPami = name.startsWith("pami");
const robotSize = isPami ? TABLE.pamiSize : TABLE.robotSize;

const imageLoader = new Image();


imageLoader.onload = () => {
robot.add(
new Konva.Image({
x: -(TABLE.robotSize * TABLE.imageRatio) / 2,
y: -(TABLE.robotSize * TABLE.imageRatio) / 2,
x: -(robotSize * TABLE.imageRatio) / 2,
y: -(robotSize * TABLE.imageRatio) / 2,
image: imageLoader,
width: TABLE.robotSize * TABLE.imageRatio,
height: TABLE.robotSize * TABLE.imageRatio,
width: robotSize * TABLE.imageRatio,
height: robotSize * TABLE.imageRatio,
shadowColor: 'black',
shadowOpacity: 1,
shadowBlur: 20,
}),
);
};

imageLoader.src = `assets/robots/${name}.png`;
if (isPami) {
imageLoader.src = `assets/robots/pami.png`;
} else {
imageLoader.src = `assets/robots/${name}.png`;
}

return robot;
}
Expand Down
1 change: 1 addition & 0 deletions src/app/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const TABLE = {
width: 3000, // taille totale en mm
height: 2000,
robotSize: 303, // taille des images des robots en mm
pamiSize: 181,
imageRatio: 1500 / 3000, // ratio des images
zoom: 0.85, // zoom appliqué au canvas
};

0 comments on commit 2a278de

Please sign in to comment.