Commit 98e614bd by Masaru Abe

#11478 解像度改善対応

parent 7bb2118e
......@@ -3143,26 +3143,41 @@ ContentPage.prototype.drawPage = function (context, opt) {
if(contentType == ContentTypeKeys.Type_PDF){
if(opt == null || opt == 0){
getPageSizeByPageNo(changePageIndex(getPageIndex()));
widthEachPage = widthContentImage;
heightEachPage = heightContentImage;
//#11478
//widthEachPage = widthContentImage;
//heightEachPage = heightContentImage;
widthEachPageApi = widthContentImage;
heightEachPageApi = heightContentImage;
}
else if(opt == 1){
getPageSizeByPageNo(changePageIndex(getPageIndex() + 1));
widthEachNextPage = widthContentImage;
heightEachNextPage = heightContentImage;
//#11478
widthEachNextPageApi = widthContentImage;
heightEachNextPageApi = heightContentImage;
}
else if(opt == 2){
getPageSizeByPageNo(changePageIndex(getPageIndex() - 1));
widthEachPrevPage = widthContentImage;
heightEachPrevPage = heightContentImage;
//#11478
widthEachPrevPageApi = widthContentImage;
heightEachPrevPageApi = heightContentImage;
}
}
else{
widthEachPage = widthContentImage;
heightEachPage = heightContentImage;
//#11478
widthEachPageApi = widthContentImage;
heightEachPageApi = heightContentImage;
widthEachNextPageApi = widthContentImage;
heightEachNextPageApi = heightContentImage;
widthEachPrevPageApi = widthContentImage;
heightEachPrevPageApi = heightContentImage;
}
/* set width canvas */
/*
if (width > height) {
......@@ -3184,18 +3199,19 @@ ContentPage.prototype.drawPage = function (context, opt) {
}*/
if(contentType == ContentTypeKeys.Type_PDF){
if(opt == null || opt == 0){
$("#offscreen").attr('height', heightEachPage);
$("#offscreen").attr('width', widthEachPage);
}
else if(opt == 1){
$("#offscreenNext").attr('height', heightEachNextPage);
$("#offscreenNext").attr('width', widthEachNextPage);
}
else if(opt == 2){
$("#offscreenPre").attr('height', heightEachPrevPage);
$("#offscreenPre").attr('width', widthEachPrevPage);
}
//#11478
//if(opt == null || opt == 0){
// $("#offscreen").attr('height', heightEachPage);
// $("#offscreen").attr('width', widthEachPage);
//}
//else if(opt == 1){
// $("#offscreenNext").attr('height', heightEachNextPage);
// $("#offscreenNext").attr('width', widthEachNextPage);
//}
//else if(opt == 2){
// $("#offscreenPre").attr('height', heightEachPrevPage);
// $("#offscreenPre").attr('width', widthEachPrevPage);
//}
}
else{
if(opt == null || opt == 0){
......@@ -3220,12 +3236,30 @@ ContentPage.prototype.drawPage = function (context, opt) {
//START TRB00097 - Editor: Long - Date: 09/30/2013 - Summary : Get All Page size of content
if(contentType == ContentTypeKeys.Type_PDF){
if(opt == null || opt == 0){
//#11478
heightEachPage = img.naturalHeight;
widthEachPage = img.naturalWidth;
$("#offscreen").attr('height', heightEachPage);
$("#offscreen").attr('width', widthEachPage);
context.drawImage(img, 0, 0, widthEachPage, heightEachPage);
}
else if(opt == 1){
//#11478
heightEachNextPage = img.naturalHeight;
widthEachNextPage = img.naturalWidth;
$("#offscreenNext").attr('height', heightEachNextPage);
$("#offscreenNext").attr('width', widthEachNextPage);
context.drawImage(img, 0, 0, widthEachNextPage, heightEachNextPage);
}
else if(opt == 2){
//#11478
heightEachPrevPage = img.naturalHeight;
widthEachPrevPage = img.naturalWidth;
$("#offscreenPre").attr('height', heightEachPrevPage);
$("#offscreenPre").attr('width', widthEachPrevPage);
context.drawImage(img, 0, 0, widthEachPrevPage, heightEachPrevPage);
}
}
......@@ -4010,7 +4044,7 @@ function drawCanvas(opt) {
context.clearRect(0, 0, canvas.width, canvas.height);
draw(context);
draw(context, 0);
}
//Draw on next offscreen
else if (opt==1){
......@@ -4828,7 +4862,26 @@ function changeImageType4(objTarget, nIndex, nIndex1) {
imageObj.onload = function () {
var canvasObject = document.getElementById("offscreen");
var contextObject = canvasObject.getContext("2d");
contextObject.drawImage(imageObj, objTarget[nIndex].x, objTarget[nIndex].y, objTarget[nIndex].width, objTarget[nIndex].height);
//#11478
var canvasWidth = $('#offscreen').width();
var canvasHeight = $('#offscreen').height();
var tempRatioWidth = canvasWidth / widthEachPageApi;
if( tempRatioWidth < 1 ){
tempRatioWidth = 1;
}
var tempRatioHeight = canvasHeight / heightEachPageApi;
if( tempRatioHeight < 1 ){
tempRatioHeight = 1;
}
var tmpX = objTarget[nIndex].x * tempRatioWidth;
var tmpY = objTarget[nIndex].y * tempRatioHeight;
var tmpW = objTarget[nIndex].width * tempRatioWidth;
var tmpH = objTarget[nIndex].height * tempRatioHeight;
contextObject.drawImage(imageObj, tmpX, tmpY, tmpW, tmpH);
//contextObject.drawImage(imageObj, objTarget[nIndex].x, objTarget[nIndex].y, objTarget[nIndex].width, objTarget[nIndex].height);
flip();
};
imageObj.src = objTarget[nIndex].dataObjects[nIndex1].fileName;
......@@ -4836,14 +4889,28 @@ function changeImageType4(objTarget, nIndex, nIndex1) {
function imageToScreen(x, y) {
//#11478
var canvasWidth = $('#offscreen').width();
var canvasHeight = $('#offscreen').height();
var tempRatioWidth = canvasWidth / widthEachPageApi;
if( tempRatioWidth < 1 ){
tempRatioWidth = 1;
}
var tempRatioHeight = canvasHeight / heightEachPageApi;
if( tempRatioHeight < 1 ){
tempRatioHeight = 1;
}
var tmpX = x * tempRatioWidth;
var tmpY = y * tempRatioHeight;
var pt = new Point(0, 0);
// scale vertical and horizontal
var sx = (destRect.right - destRect.left) / (srcRect.right - srcRect.left);
var sy = (destRect.bottom - destRect.top) / (srcRect.bottom - srcRect.top);
pt.x = Math.round(sx * (x - srcRect.left)) + destRect.left + marginX;
pt.y = Math.round(sy * (y - srcRect.top)) + destRect.top + marginY;
pt.x = Math.round(sx * (tmpX - srcRect.left)) + destRect.left + marginX;
pt.y = Math.round(sy * (tmpY - srcRect.top)) + destRect.top + marginY;
return pt;
};
......
......@@ -101,6 +101,15 @@ var widthEachPrevPage = 0;
var heightEachPrevPage = 0;
//END TRB00097 - Editor: Long - Date: 09/30/2013 - Summary : Get All Page size of content
//#11478
var widthEachPageApi = 0;
var heightEachPageApi = 0;
var widthEachNextPageApi = 0;
var heightEachNextPageApi = 0;
var widthEachPrevPageApi = 0;
var heightEachPrevPageApi = 0;
//#11478
/* zoom video */
var pxVideo;
var pyVideo;
......
......@@ -1388,6 +1388,9 @@ function getPrevPageObjectsByPageIndex(contentData, nIndexPage) {
function switchCanvas(nav){
// change div id
//console.log("bf widthEachPage:" + widthEachPage + " widthEachNextPage:" + widthEachNextPage + " widthEachPrevPage:" + widthEachPrevPage);
//console.log("bf widthEachPageApi:" + widthEachPageApi + " widthEachNextPageApi:" + widthEachNextPageApi + " widthEachPrevPageApi:" + widthEachPrevPageApi);
if(nav == 1){
$('#mainPre').attr("id","mainPreBK");
$('#main').attr("id","mainPre");
......@@ -1402,9 +1405,15 @@ function switchCanvas(nav){
//START TRB00097 - Editor: Long - Date: 09/30/2013 - Summary : Get All Page size of content
widthEachPrevPage = widthEachPage;
widthEachPage = widthEachNextPage;
//#11478
widthEachPrevPageApi = widthEachPageApi;
widthEachPageApi = widthEachNextPageApi;
heightEachPrevPage = heightEachPage;
heightEachPage = heightEachNextPage;
//#11478
heightEachPrevPageApi = heightEachPageApi;
heightEachPageApi = heightEachNextPageApi;
srcRectPrev = srcRect;
srcRect = srcRectNext;
......@@ -1432,9 +1441,15 @@ function switchCanvas(nav){
//START TRB00097 - Editor: Long - Date: 09/30/2013 - Summary : Get All Page size of content
widthEachNextPage = widthEachPage;
widthEachPage = widthEachPrevPage;
//#11478
widthEachNextPageApi = widthEachPageApi;
widthEachPageApi = widthEachPrevPageApi;
heightEachNextPage = heightEachPage;
heightEachPage = heightEachPrevPage;
//#11478
heightEachNextPageApi = heightEachPageApi;
heightEachPageApi = heightEachPrevPageApi;
srcRectNext = srcRect;
srcRect = srcRectPrev;
......@@ -1449,6 +1464,9 @@ function switchCanvas(nav){
//END TRB00097 - Editor: Long - Date: 09/30/2013 - Summary : Get All Page size of content
}
//console.log("af widthEachPage:" + widthEachPage + " widthEachNextPage:" + widthEachNextPage + " widthEachPrevPage:" + widthEachPrevPage);
//console.log("af widthEachPageApi:" + widthEachPageApi + " widthEachNextPageApi:" + widthEachNextPageApi + " widthEachPrevPageApi:" + widthEachPrevPageApi);
};
//Assign content properties
......
......@@ -53,8 +53,12 @@ function dlgMarking_dspSave_click() {
marking.pageNo = changePageIndex(getPageIndex());
}
var saveCanvas = document.createElement('canvas');
saveCanvas.width = canvas_offscreen.width;
saveCanvas.height = canvas_offscreen.height;
//#11478
//saveCanvas.width = canvas_offscreen.width;
//saveCanvas.height = canvas_offscreen.height;
saveCanvas.width = widthEachPageApi;
saveCanvas.height = heightEachPageApi;
var saveContext = saveCanvas.getContext('2d');
saveContext.drawImage(saveImg, 0, 0, saveCanvas.width, saveCanvas.height);
......@@ -87,7 +91,9 @@ function dlgMarking_dspSave_click() {
/* case exist marking */
//=== Start Function : No.17 Editor : Long Date: 07/30/2013 Summary : Set UTC time when edit marking/maker.
var editedMarkingEntity = arr[nIndexMarking];
editedMarkingEntity.content = canvas_draw.toDataURL("image/png");
//#11478
//editedMarkingEntity.content = canvas_draw.toDataURL("image/png");
editedMarkingEntity.content = marking.content;
editedMarkingEntity.registerDate = new Date();
arr[nIndexMarking] = editedMarkingEntity;
......
......@@ -47,8 +47,24 @@ function memoSaveFunction(){
memoObj.contentid = conid;
memoObj.Text = $('#txaMemoContent').val();
var imagePt = screenToImage(targetX, targetY);
memoObj.posX = imagePt.x;
memoObj.posY = imagePt.y;
//#11478 逆に縮める対応
var canvasWidth = $('#offscreen').width();
var canvasHeight = $('#offscreen').height();
//var tempRatioWidth = canvasWidth / widthEachPageApi;
var tempRatioWidth = widthEachPageApi / canvasWidth;
if( tempRatioWidth > 1 ){
tempRatioWidth = 1;
}
var tempRatioHeight = heightEachPageApi / canvasHeight;
if( tempRatioHeight > 1 ){
tempRatioHeight = 1;
}
memoObj.posX = Math.round(imagePt.x * tempRatioWidth);
memoObj.posY = Math.round(imagePt.y * tempRatioHeight);
//memoObj.posX = imagePt.x;
//memoObj.posY = imagePt.y;
//=== Start Function : No.17 Editor : Long Date: 07/30/2013 Summary : Set UTC time and UUID when create new memo.
memoObj.memoid = getUUID();
memoObj.registerDate = new Date();
......
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