From 1469e59e978f7f7f2cfa1ecbfbb39db4686bd4f1 Mon Sep 17 00:00:00 2001 From: bluesaxman Date: Thu, 10 Feb 2022 15:12:18 -0700 Subject: [PATCH] Fixed grow method in container and shape class --- libs/bluepixle.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/bluepixle.js b/libs/bluepixle.js index ee61de3..308a420 100644 --- a/libs/bluepixle.js +++ b/libs/bluepixle.js @@ -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)); }