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;
};
......
......@@ -28,20 +28,59 @@ MemoObject.prototype.setup = function (id, text, x, y, w, h, imageUrl) {
/* prototype hitTest */
MemoObject.prototype.hitTest = function (px, py) {
if (this.x <= px && px <= (this.x + this.width)) {
if (this.y <= py && py <= (this.y + this.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 = this.x * tempRatioWidth;
var tmpY = this.y * tempRatioHeight;
var tmpW = this.width * tempRatioWidth;
var tmpH = this.height * tempRatioHeight;
if (tmpX <= px && px <= (tmpX + tmpW)) {
if (tmpY <= py && py <= (tmpY + tmpH)) {
return true;
}
}
//if (this.x <= px && px <= (this.x + this.width)) {
// if (this.y <= py && py <= (this.y + this.height)) {
// return true;
// }
//}
return false;
};
/* draw Memo */
MemoObject.prototype.drawMemo = function (context, opt) {
var posX = this.x;
var posY = this.y;
var objWidth = this.width;
var objHeigth = this.height;
//#1478
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 posX = this.x * tempRatioWidth;
var posY = this.y * tempRatioHeight;
var objWidth = this.width * tempRatioWidth;
var objHeigth = this.height * tempRatioHeight;
//var posX = this.x;
//var posY = this.y;
//var objWidth = this.width;
//var objHeigth = this.height;
var imageObj = new Image();
imageObj.onload = function () {
......@@ -103,8 +142,25 @@ WebGetContentTyp4Object.prototype.setup = function (id, x, y, w, h, imageUrl) {
/* prototype hitTest */
WebGetContentTyp4Object.prototype.hitTest = function (px, py) {
if (this.x <= px && px <= (this.x + this.width)) {
if (this.y <= py && py <= (this.y + this.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 = this.x * tempRatioWidth;
var tmpY = this.y * tempRatioHeight;
var tmpW = this.width * tempRatioWidth;
var tmpH = this.height * tempRatioHeight;
if (tmpX <= px && px <= (tmpX + tmpW)) {
if (tmpY <= py && py <= (tmpY + tmpH)) {
return true;
}
}
......@@ -113,10 +169,23 @@ WebGetContentTyp4Object.prototype.hitTest = function (px, py) {
/* draw Memo */
WebGetContentTyp4Object.prototype.drawObject = function (context, opt) {
var posX = this.x;
var posY = this.y;
var objWidth = this.width;
var objHeigth = this.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 posX = this.x * tempRatioWidth;
var posY = this.y * tempRatioHeight;
var objWidth = this.width * tempRatioWidth;
var objHeigth = this.height * tempRatioHeight;
var imageObj = new Image();
imageObj.onload = function () {
context.globalAlpha = 0.4;
......@@ -186,11 +255,33 @@ PageObject.prototype.setup = function (mediaType, actionType, id, imageUrl, x, y
/* prototype hitTest */
PageObject.prototype.hitTest = function (px, py) {
if (this.x <= px && px <= (this.x + this.width)) {
if (this.y <= py && py <= (this.y + this.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 = this.x * tempRatioWidth;
var tmpY = this.y * tempRatioHeight;
var tmpW = this.width * tempRatioWidth;
var tmpH = this.height * tempRatioHeight;
if ( tmpX <= px && px <= (tmpX + tmpW)) {
if (tmpY <= py && py <= (tmpY + tmpH)) {
return true;
}
}
//if (this.x <= px && px <= (this.x + this.width)) {
// if (this.y <= py && py <= (this.y + this.height)) {
// return true;
// }
//}
return false;
};
var check;
......@@ -199,26 +290,73 @@ var check;
PageObject.prototype.drawPageObject = function (context, opt) {
var nObjectCnt = 0;
//#11478
var tempRatioWidth = 1;
var tempRatioHeight = 1;
var canvasWidth = 0;
var canvasHeight = 0;
//Check which pageObject to be count
if(opt == null || opt == 0){
nObjectCnt = pageObjects.length;
//#11478
canvasWidth = $('#offscreen').width();
canvasHeight = $('#offscreen').height();
tempRatioWidth = canvasWidth / widthEachPageApi;
if( tempRatioWidth < 1 ){
tempRatioWidth = 1;
}
var tempRatioHeight = canvasHeight / heightEachPageApi;
if( tempRatioHeight < 1 ){
tempRatioHeight = 1;
}
}
else if(opt == 1){
nObjectCnt = nextPageObjects.length;
//#11478
canvasWidth = $('#offscreenNext').width();
canvasHeight = $('#offscreenNext').height();
tempRatioWidth = canvasWidth / widthEachNextPageApi;
if( tempRatioWidth < 1 ){
tempRatioWidth = 1;
}
var tempRatioHeight = canvasHeight / heightEachNextPageApi;
if( tempRatioHeight < 1 ){
tempRatioHeight = 1;
}
}
else if(opt == 2){
nObjectCnt = prevPageObjects.length;
//#11478
canvasWidth = $('#offscreenPre').width();
canvasHeight = $('#offscreenPre').height();
tempRatioWidth = canvasWidth / widthEachPrevPageApi;
if( tempRatioWidth < 1 ){
tempRatioWidth = 1;
}
var tempRatioHeight = canvasHeight / heightEachPrevPageApi;
if( tempRatioHeight < 1 ){
tempRatioHeight = 1;
}
}
if (this.visible) {
/* init data */
var mediaType = this.mediaType;
var displayBorder = this.displayBorder;
var x = this.x;
var y = this.y;
var w = this.width;
var h = this.height;
//#11478
var x = this.x * tempRatioWidth;
var y = this.y * tempRatioHeight;
var w = this.width * tempRatioWidth;
var h = this.height * tempRatioHeight;
var tempUrl = this.imageUrl;
var isUsedTempImg = false;
......@@ -462,11 +600,27 @@ var object3d = function (mediaType, actionType, id, imageUrl, x, y, w, h, hCnt,
//abe
//alert("object3d");
//#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 tmpW = w * tempRatioWidth;
var tmpH = h * tempRatioHeight;
if(_3dAction == _3dActionType.TouchStart_MouseDown){
OnMouseDown3D(id, imagePt, x, y);
OnMouseDown3D(id, imagePt, tmpX, tmpY);
}
else if(_3dAction == _3dActionType.TouchMove_MouseMove){
OnMouseMove3D(id, imagePt, x, y, w, h, hCnt, vCnt);
OnMouseMove3D(id, imagePt, tmpX, tmpY, tmpW, tmpH, hCnt, vCnt);
}
else if(_3dAction == _3dActionType.TouchEnd_MouseUp){
OnMouseEnd3D(id, hCnt, vCnt);
......@@ -548,7 +702,24 @@ var listImage = function (mediaType, id, imageUrl, x, y, w, h, visible, imageObj
imageObj.onload = function () {
var canvasObject = document.getElementById("offscreen");
var contextObject = canvasObject.getContext("2d");
contextObject.drawImage(imageObj, x, y, w, h);
//#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 tmpW = w * tempRatioWidth;
var tmpH = h * tempRatioHeight;
contextObject.drawImage(imageObj, tmpX, tmpY, tmpW, tmpH);
flip();
};
imageObj.src = imageObjects[mediaType4_changeImage].fileName;
......
......@@ -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