diff --git a/module.json b/module.json index 570f718..085c215 100644 --- a/module.json +++ b/module.json @@ -9,7 +9,7 @@ "email": "dev7355608@gmail.com" } ], - "version": "2.0.9", + "version": "2.0.10", "compatibility": { "minimum": "10", "verified": "11" @@ -28,8 +28,8 @@ }, "url": "https://github.com/dev7355608/advanced-drawing-tools", "manifest": "https://raw.githubusercontent.com/dev7355608/advanced-drawing-tools/main/module.json", - "download": "https://github.com/dev7355608/advanced-drawing-tools/releases/download/v2.0.9/module.zip", - "changelog": "https://github.com/dev7355608/advanced-drawing-tools/releases/tag/v2.0.9", + "download": "https://github.com/dev7355608/advanced-drawing-tools/releases/download/v2.0.10/module.zip", + "changelog": "https://github.com/dev7355608/advanced-drawing-tools/releases/tag/v2.0.10", "bugs": "https://github.com/dev7355608/advanced-drawing-tools/issues", "readme": "https://raw.githubusercontent.com/dev7355608/advanced-drawing-tools/main/README.md", "license": "https://raw.githubusercontent.com/dev7355608/advanced-drawing-tools/main/LICENSE" diff --git a/scripts/index.js b/scripts/index.js index c221b67..9c333cc 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -47,31 +47,7 @@ Hooks.once("libWrapper.Ready", () => { }, libWrapper.OVERRIDE); } else { Drawing.prototype._rescaleDimensions = function (original, dx, dy) { - let { points, width, height } = original.shape; - width += dx; - height += dy; - points = points || []; - - // Rescale polygon points - if (this.isPolygon) { - const scaleX = 1 + (dx / original.shape.width); - const scaleY = 1 + (dy / original.shape.height); - points = points.map((p, i) => p * (i % 2 ? scaleY : scaleX)); - } - - // Constrain drawing bounds by the contained text size - if (this.document.text) { - const textBounds = this.text.getLocalBounds(); - width = Math.max(textBounds.width + 16, width); - height = Math.max(textBounds.height + 8, height); - } - - // Normalize the shape - return this.constructor.normalizeShape({ - x: original.x, - y: original.y, - shape: { width: Math.round(width), height: Math.round(height), points } - }); + return Drawing.rescaleDimensions(original, dx, dy); }; } });