initItemRows() {
return new FormGroup({
name: new FormControl('Test ticket name'),
description: new FormControl('Test description'),
full_price: new FormControl(100),
booking: new FormControl()
});
}
addNewRow() {
const control = <FormArray>this.invoiceForm.get('itemRows');
control.push(this.initItemRows());
}
createWall() {
minHeight = 10;
maxHeight = 30;
minWidth = 20;
maxWidth = 40;
width = Random.value * (maxWidth - minWidth) + minWidth;
height = Random.value * (maxHeight - minHeight) + minHeight;
// code to place wall
}
minDistanceBetweenWalls = 100;
distance = 0;
ticker() {
distance++;
if (distance > minDistanceBetweenWalls) {
// some chance to place wall
if (Random.value > .9) {
createWall();
distance = 0;
}
}
}