From a50e819acbf951e2b1bc862c818fcfa0b2e6594a Mon Sep 17 00:00:00 2001 From: Barry Chen Date: Thu, 24 May 2018 14:47:19 -0500 Subject: [PATCH] Scale the drawing when saving history. (#4370) --- server/src/pages/shot/editor-history.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server/src/pages/shot/editor-history.js b/server/src/pages/shot/editor-history.js index 00db0b91c1..830bea0614 100644 --- a/server/src/pages/shot/editor-history.js +++ b/server/src/pages/shot/editor-history.js @@ -89,13 +89,18 @@ class EditRecord { copy.width = canvas.width; copy.height = canvas.height; const copyContext = copy.getContext("2d"); - copyContext.drawImage(canvas, 0, 0); + copyContext.scale(devicePixelRatio, devicePixelRatio); + copyContext.drawImage( + canvas, + 0, 0, canvas.width, canvas.height, + 0, 0, area.width, area.height); return copy; } - copy.width = area.width; - copy.height = area.height; + copy.width = area.width * devicePixelRatio; + copy.height = area.height * devicePixelRatio; const copyContext = copy.getContext("2d"); + copyContext.scale(devicePixelRatio, devicePixelRatio); copyContext.drawImage( canvas, area.left * devicePixelRatio,