Fixed grow method in container and shape class
This commit is contained in:
parent
2cc3f4d0cf
commit
1469e59e97
@ -77,8 +77,11 @@ class shape {
|
|||||||
ctx.imageSmoothingEnabled = local.imageSmoothingEnabled;
|
ctx.imageSmoothingEnabled = local.imageSmoothingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
grow (amp) {
|
grow (factor=1) {
|
||||||
this.dimentions = this.dimentions.amp(amp);
|
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]);
|
ctx.translate(-refPos.d[0],-refPos.d[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
grow(amp) {
|
grow(amp,includeBase) {
|
||||||
amp = !isNaN(amp) ? amp : 1;
|
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) {
|
if (this.shapes.length) {
|
||||||
this.shapes.forEach(shape => shape.grow(amp));
|
this.shapes.forEach(shape => shape.grow(amp));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user