From 74414581d3fb29ac408acee151105524d656f322 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Sun, 24 Mar 2019 17:36:52 +0100 Subject: [PATCH] Fix shadow offsets on dataUrl export (#5593) --- src/mixins/canvas_dataurl_exporter.mixin.js | 3 + test/visual/golden/dataurl10.png | Bin 0 -> 518 bytes test/visual/golden/dataurl12.png | Bin 0 -> 924 bytes test/visual/toDataURL.js | 127 ++++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 test/visual/golden/dataurl10.png create mode 100644 test/visual/golden/dataurl12.png diff --git a/src/mixins/canvas_dataurl_exporter.mixin.js b/src/mixins/canvas_dataurl_exporter.mixin.js index 7e8ee51567b..86e63eed60f 100644 --- a/src/mixins/canvas_dataurl_exporter.mixin.js +++ b/src/mixins/canvas_dataurl_exporter.mixin.js @@ -71,9 +71,11 @@ originalInteractive = this.interactive, originalContext = this.contextContainer, newVp = [newZoom, 0, 0, newZoom, translateX, translateY], + originalRetina = this.enableRetinaScaling, canvasEl = fabric.util.createCanvasElement(); canvasEl.width = scaledWidth; canvasEl.height = scaledHeight; + this.enableRetinaScaling = false; this.interactive = false; this.viewportTransform = newVp; this.width = scaledWidth; @@ -88,6 +90,7 @@ this.calcViewportBoundaries(); this.contextContainer = originalContext; this.interactive = originalInteractive; + this.enableRetinaScaling = originalRetina; return canvasEl; }, }); diff --git a/test/visual/golden/dataurl10.png b/test/visual/golden/dataurl10.png new file mode 100644 index 0000000000000000000000000000000000000000..2b25655312241cbc8321735918b6d95eaec3ecad GIT binary patch literal 518 zcmeAS@N?(olHy`uVBq!ia0vp^(?FPm4M^HB7Cr(}Y)RhkE)4%caKYZ?lNlHocYC@x zhE&XXd)LrAI#HtSp?h#h(y?F4Eq&|$RbB66O^-DWW4@#)%agnCiNew6HN896ePr3U zXM**8$@?q}3>F;f)${7-mUdO%?U8#RF{e+iq5tLOEA6XODrf3EmsG~%l zAHR9~u79(y-lR2U{rS@Or#>+}>HP9d^XK@MuYbSy|GOvVxykq3W&YQChkhMhJ%KAR zP*F###kFXnS_^r?RQ{CaJM~)LN2szqi!*G0*mwYpaq4fVvKgCq64RetGwW l;=O~9UoZlrhD6X%|4DfBSC#iw!G&@lt)8xaF6*2UngAVt%uE0P literal 0 HcmV?d00001 diff --git a/test/visual/golden/dataurl12.png b/test/visual/golden/dataurl12.png new file mode 100644 index 0000000000000000000000000000000000000000..e167a2c55ddd8649f3ddfee0b1d5ff8ec7c4afc6 GIT binary patch literal 924 zcmeAS@N?(olHy`uVBq!ia0y~yVAKI&4mO}jWo=(6kYY>nc6VX;4}uH!E}zW6z#Qo5 z;uumf=k1;SUeSdz?GM-2vrTUb*u$}Maro1%WougEoObW(xNt);mdjDg^5c`G=Z#qn zA1Pp5?$HMg@2hG^PS3r&HpE8gGG4`f|W%4 zxv=-e^E1zLb?&YIJ%9IXTls2>Z_`+9&%Se={k}f$a6C(P+BW0o`_uHU-TUbG``+oC z`_~I<-zakLo^?Z?->y%d2V@1*Fo=C4n4>qn?!fMux0lL)z7bb`zkT!8a)$ikR@M{_ zu?dQh=wg@MWq&Sbn$)IEvuEy%sAlMOVuQJ~%R(FH*#-EeZ;;zXZ%KS7<%X