MCPcopy Create free account
hub / github.com/AlloyTeam/AlloyImage / drawImageIOSFix

Function drawImageIOSFix

nsrc/alloyimage.fix.js:36–44  ·  view source on GitHub ↗

* A replacement for context.drawImage * (args are for source and destination).

(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh)

Source from the content-addressed store, hash-verified

34 * (args are for source and destination).
35 */
36 function drawImageIOSFix(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {
37 var vertSquashRatio = detectVerticalSquash(img);
38 // Works only if whole image is displayed:
39 // ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
40 // The following works correct also when only a part of the image is displayed:
41 ctx.drawImage(img, sx * vertSquashRatio, sy * vertSquashRatio,
42 sw * vertSquashRatio, sh * vertSquashRatio,
43 dx, dy, dw, dh );
44 }
45
46 function drawImageIOS(ctx, img, dw, dh){
47 var sx = 0,

Callers 1

drawImageIOSFunction · 0.70

Calls 1

detectVerticalSquashFunction · 0.70

Tested by

no test coverage detected