diff --git a/package-lock.json b/package-lock.json index 755b4f4..6a4ae2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@leosac/cardrendering", - "version": "1.7.2", + "version": "1.7.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@leosac/cardrendering", - "version": "1.7.2", + "version": "1.7.3", "license": "LGPL-3.0-or-later", "dependencies": { "bwip-js": "^3.2.2", diff --git a/package.json b/package.json index 9b06f20..c89c67f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@leosac/cardrendering", - "version": "1.7.2", + "version": "1.7.3", "description": "Card Rendering engine for CR-80 cards and more", "main": "dist/cardrendering.node.js", "browser": "dist/cardrendering.js", diff --git a/src/lib/cardrenderer.js b/src/lib/cardrenderer.js index 9ef03d5..96dc0fd 100644 --- a/src/lib/cardrenderer.js +++ b/src/lib/cardrenderer.js @@ -152,8 +152,9 @@ class CardRenderer { this.data.grid.ruler = false; this.data.grid.scale = 1 - ((width - parentRectoContainer.offsetWidth) / width); } else { - if (resize) + if (resize) { this.data.grid.scale = 1; + } } if (this.data.grid.ruler) { width += rulerwidth + rulerspacing * 2; diff --git a/src/lib/fieldFactory.js b/src/lib/fieldFactory.js index 1245b38..6e20ecb 100644 --- a/src/lib/fieldFactory.js +++ b/src/lib/fieldFactory.js @@ -19,7 +19,7 @@ function setFieldBorder(box, border) { } } -function createTextField(options) +function createTextField(options, scale = 1) { options.type = 'label'; const text = new PIXI.Text(options.value); @@ -39,6 +39,7 @@ function createTextField(options) options.fontStyle = "Normal"; } text.style = style; + text.resolution = scale; if (options.wordBreak) { text.wordWrap = true; text.wordWrapWidth = options.width; @@ -153,8 +154,8 @@ async function createBwipSprint(options, bwopts, dpi = 300) { sprite.y = options.y; sprite.height = height; sprite.width = width; - options.height = sprite.height; - options.width = sprite.width; + options.height = height; + options.width = width; if (options.rotation > 0) { sprite.angle = options.rotation; } diff --git a/src/lib/fields.js b/src/lib/fields.js index ed107ad..4f614d9 100644 --- a/src/lib/fields.js +++ b/src/lib/fields.js @@ -141,7 +141,7 @@ class Fields { color: 0x000000 }, ...options - }); + }, this.cardside.data.grid.scale); } else if (options.type === 'picture') { field = await createPictureField({ useMacros: false,