Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/showFullImg.jsp =================================================================== diff -u -r31458 -r31460 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/showFullImg.jsp (.../showFullImg.jsp) (revision 31458) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/showFullImg.jsp (.../showFullImg.jsp) (revision 31460) @@ -76,6 +76,46 @@ return img; }, + setImgInitWH:function(){ + var box = document.getElementById("ip-img-preview"); + setTimeout(function(){ + if(box.width !== 0 && box.height !== 0){ + var clientWidth = document.body.clientWidth; + var clientHeight = document.body.clientHeight; + var newWidth = 0; + var newHeight = 0; + if(clientWidth > box.width && clientHeight > box.height){ + newWidth = box.width; + newHeight = box.height; + }else { + if(box.width > box.height){ + newWidth = clientWidth; + newHeight = box.height/(box.width/clientWidth); + }else { + newWidth = box.width/(box.height/clientHeight); + newHeight = clientHeight; + } + } + + var img = { + width:newWidth, + height:newHeight + } + + that.fnReturnImgObject(img,function(imgObj){ + var newLeft = imgObj.left; + var newTop = imgObj.top; + + $('#ip-img-preview').css({ + width:parseInt(newWidth)+'px', + height:parseInt(newHeight)+'px', + top:parseInt(newTop)+'px', + left:parseInt(newLeft)+'px' + }) + }) + } + }, 100); + }, fnBindEvent:function (ip_global_img) { if (ip_global_img == '') { return; @@ -104,6 +144,7 @@ }); this.onDragEvent(); + that.setImgInitWH(); }, showTool:function(){ if(isMove){ @@ -145,6 +186,7 @@ $("#ip-page .page").text(page); $("#ip-img-preview").attr("src", imgUrl); ImagePreview.fnReset(imgUrl); + that.setImgInitWH(); } }, fnNext:function () { @@ -154,6 +196,7 @@ $("#ip-page .page").text(page); $("#ip-img-preview").attr("src", imgUrl); ImagePreview.fnReset(imgUrl); + that.setImgInitWH(); } }, onClickEvent:function (e) {