c67ac37d by Jeff Balicki

h

1 parent 57aa86b8
1 //var pluginUrl = "http://contact-form.dev"; 1 //var pluginUrl = "http://localhost:8888/Forms";
2 //var pdf_customizer = "http://pdf-customizer.dev/public"; 2 //var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
3
3 4
4 var pluginUrl = "http://contact.gotenzing.com"; 5 var pluginUrl = "http://contact.gotenzing.com";
5 var pdf_customizer = "http://pdf-customizer.synapsus.co"; 6 var pdf_customizer = "http://pdf-customizer.synapsus.co";
...@@ -41,6 +42,19 @@ function offFocus(id) { ...@@ -41,6 +42,19 @@ function offFocus(id) {
41 }); 42 });
42 } 43 }
43 44
45 CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
46 if (w < 2 * r) r = w / 2;
47 if (h < 2 * r) r = h / 2;
48 this.beginPath();
49 this.moveTo(x+r, y);
50 this.arcTo(x+w, y, x+w, y+h, r);
51 this.arcTo(x+w, y+h, x, y+h, r);
52 this.arcTo(x, y+h, x, y, r);
53 this.arcTo(x, y, x+w, y, r);
54 this.closePath();
55 return this;
56 }
57
44 function ShowBox(pheight, pwidth, up, right, height, width, count, example) { 58 function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
45 jQuery(document).ready(function($) { 59 jQuery(document).ready(function($) {
46 $('span').hide(); 60 $('span').hide();
...@@ -52,6 +66,8 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) { ...@@ -52,6 +66,8 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
52 Qctx.clearRect(0, 0, Qc.width, Qc.height); 66 Qctx.clearRect(0, 0, Qc.width, Qc.height);
53 Qctx.restore(); 67 Qctx.restore();
54 68
69
70
55 var down = pheight - (up + height); 71 var down = pheight - (up + height);
56 var scaleH = $("Canvas").height() / pheight; 72 var scaleH = $("Canvas").height() / pheight;
57 var scaleW = $("Canvas").width() / pwidth; 73 var scaleW = $("Canvas").width() / pwidth;
...@@ -59,14 +75,20 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) { ...@@ -59,14 +75,20 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
59 var scaleRight = right * scaleW; 75 var scaleRight = right * scaleW;
60 var scalewidth = width * scaleW; 76 var scalewidth = width * scaleW;
61 var scaleheight = height * scaleH; 77 var scaleheight = height * scaleH;
62 78 var radius = '50';
63 var c = document.getElementById("Canvas"); 79 var c = document.getElementById("Canvas");
64 var ctx = c.getContext("2d"); 80 var ctx = c.getContext("2d");
65 ctx.save(); 81 ctx.save();
66 ctx.rect(scaleRight, scaleDown, scalewidth, scaleheight); 82 ctx.lineWidth=2;
67 console.log(scaleRight, scaleDown, scalewidth, scaleheight); 83 ctx.strokeStyle="#F7A800";
68 console.log($("Canvas").height(), $("Canvas").width(), scaleW, scaleH); 84 ctx.roundRect(scaleRight, scaleDown, scalewidth, scaleheight, 20).stroke();
69 ctx.stroke(); 85 //ctx.rect(scaleRight, scaleDown, scalewidth, scaleheight );
86 //console.log(scaleRight, scaleDown, scalewidth, scaleheight);
87 //console.log($("Canvas").height(), $("Canvas").width(), scaleW, scaleH);
88 //
89 //ctx.lineWidth=2;
90 //ctx.lineCap = "round";
91 //ctx.stroke();
70 //console.log(pheight, pwidth,up, right, height, width); 92 //console.log(pheight, pwidth,up, right, height, width);
71 // console.log(myrect ) 93 // console.log(myrect )
72 }); 94 });
...@@ -200,7 +222,8 @@ function changePdfOptions(json) { ...@@ -200,7 +222,8 @@ function changePdfOptions(json) {
200 } 222 }
201 if (json[i].change_type == "date") { 223 if (json[i].change_type == "date") {
202 pdfChange += json[i].names + ': <input onfocusout="HideBoxwithdate()" onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontentdate" type="text" class="required date" name="content[' + i + ']" value="' + json[i].content + '"">'; 224 pdfChange += json[i].names + ': <input onfocusout="HideBoxwithdate()" onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontentdate" type="text" class="required date" name="content[' + i + ']" value="' + json[i].content + '"">';
203 225 pdfChange += '<span id="span' + i + '"> </span><br/>';
226
204 } 227 }
205 228
206 } 229 }
......