Commit 87751fc4 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. fixed preview borders

parent c8b40199
......@@ -87,10 +87,15 @@ var Elphel = {
sctx.canvas.width = w;
sctx.canvas.height = h;
cscale = Math.round(w/tw*100)/100;
//cscale = Math.round(w/tw*100)/100;
sctx.scale(cscale,cscale);
sctx.drawImage(cnv_src[0],0,0);
//option 1
//cscale = w/tw;
//sctx.scale(cscale,cscale);
//sctx.drawImage(cnv_src[0],0,0);
// option 2
sctx.drawImage(cnv_src[0],0,0,ctx.canvas.width,ctx.canvas.height,0,0,sctx.canvas.width,sctx.canvas.height);
console.log("drawScaled(): "+(Date.now()-t0)/1000+" s");
}
......
......@@ -2,8 +2,9 @@
position: absolute;
top: 5px;
left: 5px;
width:1170px;
height:585px;
width:1200px;
/* height:585px; */
height:600px;
padding:5px;
background:#99ff99;
}
......
......@@ -26,8 +26,8 @@
*! -----------------------------------------------------------------------------**
*/
var baseWidth = 194;
var baseHeight = 146;
var baseWidth = 200;
var baseHeight = 150;
var W = 2592;
var H = 1944;
......@@ -124,19 +124,23 @@ function draw_image(img,index){
index = +index;
var dx = Array(0,1,4);
var dw = Array(0,0,4);
cContext.rotate(90*Math.PI/180);
if (index%2==0) {
cContext.drawImage(img, 0,0*h,w,h, 0*w,-1*h*(index+1),w,h);
cContext.drawImage(img, 0,1*h,w,h, 1*w,-1*h*(index+1),w,h);
//drawImage img sx,sy, sw,sh, dx,dy, dw,dh
cContext.drawImage(img, 0,0*h+dx[0], w,h-dw[0], 0*w,-1*h*(index+1), w,h);
cContext.drawImage(img, 0,1*h+dx[1], w,h-dw[1], 1*w,-1*h*(index+1), w,h);
cContext.scale(-1,1);
cContext.drawImage(img, 0,2*h,w,h, -3*w, -1*h*(index+1), w, h);
cContext.drawImage(img, 0,2*h+dx[2], w,h-dw[2], -3*w,-1*h*(index+1), w, h);
cContext.scale(-1,1);
}else{
cContext.scale(1,-1); //mirror is needed
cContext.drawImage(img, 0,0*h,w,h, 0*w,index*h,w,h);
cContext.drawImage(img, 0,1*h,w,h, 1*w,index*h,w,h);
cContext.drawImage(img, 0,0*h+dx[0], w,h-dw[0], 0*w,index*h,w,h);
cContext.drawImage(img, 0,1*h+dx[1], w,h-dw[1], 1*w,index*h,w,h);
cContext.scale(-1,1);
cContext.drawImage(img, 0,2*h,w,h, -3*w,h*(index),w,h);
cContext.drawImage(img, 0,2*h+dx[2], w,h-dw[2], -3*w,h*(index),w,h);
cContext.scale(-1,1);
cContext.scale(1,-1);
}
......
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 to comment