From ed999e131172aa6ccea72b592cc0bcbf85be1c74 Mon Sep 17 00:00:00 2001 From: Maciej Ziarkowski Date: Mon, 7 Oct 2019 17:01:41 +0100 Subject: [PATCH] Use gravity instead of top/left for tile composite --- app/src/tiles/renderers/stitchTile.ts | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/app/src/tiles/renderers/stitchTile.ts b/app/src/tiles/renderers/stitchTile.ts index 8c820d57..eb7acb84 100644 --- a/app/src/tiles/renderers/stitchTile.ts +++ b/app/src/tiles/renderers/stitchTile.ts @@ -26,26 +26,10 @@ async function stitchTile({ tileset, z, x, y, scale }: TileParams, dataParams: a background: { r: 0, g: 0, b: 0, alpha: 0 } } }).composite([ - { - input: topLeft, - top: 0, - left: 0 - }, - { - input: topRight, - top: 0, - left: tileSize - }, - { - input: bottomLeft, - top: tileSize, - left: 0 - }, - { - input: bottomRight, - top: tileSize, - left: tileSize - } + {input: topLeft, gravity: sharp.gravity.northwest}, + {input: topRight, gravity: sharp.gravity.northeast}, + {input: bottomLeft, gravity: sharp.gravity.southwest}, + {input: bottomRight, gravity: sharp.gravity.southeast} ]).png().toBuffer(); return sharp(compositedBuffer)