Commit 98e614bd by Masaru Abe

#11478 解像度改善対応

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