Fixed grow method in container and shape class

This commit is contained in:
bluesaxman 2022-02-10 15:12:18 -07:00
parent 2cc3f4d0cf
commit 1469e59e97

View File

@ -77,8 +77,11 @@ class shape {
ctx.imageSmoothingEnabled = local.imageSmoothingEnabled;
}
grow (amp) {
this.dimentions = this.dimentions.amp(amp);
grow (factor=1) {
factor = !isNaN(factor) ? factor : 1;
var half = this.dimentions.mag(factor/2);
this.dimentions = this.dimentions.mag(factor);
this.coordinates = this.coordinates.mag(factor);
}
}
@ -134,9 +137,12 @@ class container {
ctx.translate(-refPos.d[0],-refPos.d[1]);
}
grow(amp) {
grow(amp,includeBase) {
amp = !isNaN(amp) ? amp : 1;
this.position.mag(amp);
if (includeBase) {
this.size = this.size.mag(amp);
this.coordinates = this.coordinates.mag(amp);
}
if (this.shapes.length) {
this.shapes.forEach(shape => shape.grow(amp));
}