Commit f4cb8ace by doszhang

dos

parent 120a7ff5
......@@ -48,7 +48,7 @@ $('input[name=name]').attr('placeholder', '姓名');
$('input[name=business]').attr('placeholder', '业务号');
$('.page1 .num').html('已有 <span class="numbig">' + window.num + '</span> 人发起承诺');
//上传canvas定义
let canvasinfo = initCanvas('.upload-canvas', 'uploadCanvas', 257, 257, true),
let canvasinfo = initCanvas('.upload-canvas', 'uploadCanvas', 257, 257),
uploadCanvas = canvasinfo[0],
uploadCtx = canvasinfo[1];
......@@ -200,6 +200,20 @@ var drawImage = function (ctx, myCanvas, img, imgInfo) {
ctx.restore();
}
function initCanvas(target, id, canvasWidth, canvasHeight, useRem = false) {
if (useRem) {
canvasWidth = pxToRem(canvasWidth);
canvasHeight = pxToRem(canvasHeight);
}
$(target).append($('<canvas id="' + id + '" width="' + canvasWidth + '" height="' + canvasHeight + '"></canvas>'));
canvas = $('#' + id)[0];
ctx = canvas.getContext("2d");
ctx.scale(2, 2);
canvas.width = canvasWidth;
canvas.height = canvasHeight;
return [canvas, ctx];
}
function getTranslateDistance(cardinal = 0, abs = false) {
var wrapInnerTransform = $('.wrap-inner').css('transform');
var wrapInnertop = parseFloat($('.wrap-inner').css('top'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment