Commit 265804dd by Masaru Abe

Merge branch 'feature/1.9.0' of…

Merge branch 'feature/1.9.0' of ssh://git@gitlab.agentec.jp/abook_web/web-viewer.git into feature/1.9.0
parents 088a1a8c 40874c47
......@@ -3801,7 +3801,7 @@ CONTENTVIEW.removeObject = function() {
CONTENTVIEW.playAllAudio();
/* mediaType = 4 */
CONTENTVIEW_GENERAL.mediaType4_changeImage = 0;
CONTENTVIEW_GENERAL.mediaType4_changeImage = [];
};
/* View Component setDefaultEvent */
......@@ -5088,12 +5088,11 @@ CONTENTVIEW.changeImageType4 = function(objTarget, nIndex, nIndex1) {
var tmpW = objTarget[nIndex].width * tempRatioWidth;
var tmpH = objTarget[nIndex].height * tempRatioHeight;
contextObject.fillStyle = "#FFFFFF";
contextObject.fillRect(tmpX, tmpY, tmpW+1, tmpH+1);
var aspectType = objTarget[nIndex].aspectType;
if(aspectType == '1'){
contextObject.fillStyle = "#FFFFFF";
contextObject.fillRect(tmpX, tmpY, tmpW+1, tmpH+1);
var drawObj = CONTENTVIEW.adjustAspectRatio(tmpX, tmpY, tmpW, tmpH, imageObj.width, imageObj.height);
tmpX = drawObj.drawX;
......@@ -6410,8 +6409,8 @@ CONTENTVIEW.adjustAspectRatio = function(drawX, drawY, drawW, drawH, srcImageW,
//描画エリアとソース画像の比率計算
var drawRatio = drawObj.drawH / drawObj.drawW;
var srcRatio = srcImageH / srcImageW;
console.log("drawRatio:" + drawRatio);
console.log("srcRatio:" + srcRatio);
//console.log("drawRatio:" + drawRatio);
//console.log("srcRatio:" + srcRatio);
if( drawRatio < srcRatio ){
tmpH = drawObj.drawH;
......@@ -6445,8 +6444,8 @@ CONTENTVIEW.adjustAspectRatio = function(drawX, drawY, drawW, drawH, srcImageW,
//描画エリアとソース画像の比率計算
var drawRatio = drawObj.drawW / drawObj.drawH;
var srcRatio = srcImageW / srcImageH;
console.log("drawRatio:" + drawRatio);
console.log("srcRatio:" + srcRatio);
//console.log("drawRatio:" + drawRatio);
//console.log("srcRatio:" + srcRatio);
if( drawRatio < srcRatio ){
tmpW = drawObj.drawW;
......
......@@ -473,17 +473,14 @@ CONTENTVIEW_CREATEOBJECT.PageObject.prototype.drawPageObject = function (context
}
else if(mediaType == '4'){
//context.fillStyle = "#FFFFFF";
//context.fillRect(x, y, w, h);
if(aspectType == '1'){
context.fillStyle = "#FFFFFF";
context.fillRect(x, y, w, h);
var drawObj = CONTENTVIEW.adjustAspectRatio(x, y, w, h, img.width, img.height);
x = drawObj.drawX;
y = drawObj.drawY;
w = drawObj.drawW;
h = drawObj.drawH;
}
context.drawImage(img, x, y, w, h);
}
......@@ -787,75 +784,84 @@ CONTENTVIEW_CREATEOBJECT.listImage = function (mediaType, id, imageUrl, x, y, w,
//COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
//---
CONTENTVIEW_GENERAL.mediaType4_changeImage++;
if (!CONTENTVIEW_GENERAL.mediaType4_changeImage[id]) CONTENTVIEW_GENERAL.mediaType4_changeImage[id] = 0;
CONTENTVIEW_GENERAL.mediaType4_changeImage[id]++;
/* check index bigger than length object */
if (CONTENTVIEW_GENERAL.mediaType4_changeImage > (imageObjects.length - 1)) {
CONTENTVIEW_GENERAL.mediaType4_changeImage = 0;
if (CONTENTVIEW_GENERAL.mediaType4_changeImage[id] > (imageObjects.length - 1)) {
CONTENTVIEW_GENERAL.mediaType4_changeImage[id] = 0;
}
//リソースIDセット
objectLog.resourceId = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage].resourceId;
objectLog.resourceId = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage[id]].resourceId;
COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
/* draw image */
var imageObj = new Image();
imageObj.onload = function () {
var canvasObject = document.getElementById("offscreen");
var contextObject = canvasObject.getContext("2d");
//#11478
var canvasWidth = $('#offscreen').width();
var canvasHeight = $('#offscreen').height();
var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
if( tempRatioWidth < 1 ){
tempRatioWidth = 1;
}
var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
if( tempRatioHeight < 1 ){
tempRatioHeight = 1;
}
var tmpX = x * tempRatioWidth;
var tmpY = y * tempRatioHeight;
var tmpW = w * tempRatioWidth;
var tmpH = h * tempRatioHeight;
if(aspectType == '1'){
var srcImageW = imageObj.width;
var srcImageH = imageObj.height;
//var tmpRatioImage;
//
////描画エリアが縦長か横長か
//if( tmpW > tmpH ){
// //横長
//} else {
// //縦長
// if(srcImageW > srcImageH){
// tmpRatioImage = tmpW / srcImageW;
// tmpH = srcImageH * tmpRatioImage;
// } else {
// tmpRatioImage = tmpH / srcImageH;
// tmpW = srcImageW * tmpRatioImage;
// }
//
//}
contextObject.fillStyle = "#FFFFFF";
contextObject.fillRect(tmpX, tmpY, tmpW+1, tmpH+1);
var drawObj = CONTENTVIEW.adjustAspectRatio(tmpX, tmpY, tmpW, tmpH, imageObj.width, imageObj.height);
tmpX = drawObj.drawX;
tmpY = drawObj.drawY;
tmpW = drawObj.drawW;
tmpH = drawObj.drawH;
//#28696
CONTENTVIEW_GETDATA.getContent().currentPage.pageObjects.some(function(object) {
if (object.id == id) {
object.imageUrl = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage[id]].fileName;
return true;
}
});
CONTENTVIEW.resizeScreen();
contextObject.drawImage(imageObj, tmpX, tmpY, tmpW, tmpH);
CONTENTVIEW.flip();
};
imageObj.src = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage].fileName;
/* draw image */
//var imageObj = new Image();
//imageObj.onload = function () {
// var canvasObject = document.getElementById("offscreen");
// var contextObject = canvasObject.getContext("2d");
//
// //#11478
// var canvasWidth = $('#offscreen').width();
// var canvasHeight = $('#offscreen').height();
// var tempRatioWidth = canvasWidth / CONTENTVIEW_GENERAL.widthEachPageApi;
// if( tempRatioWidth < 1 ){
// tempRatioWidth = 1;
// }
// var tempRatioHeight = canvasHeight / CONTENTVIEW_GENERAL.heightEachPageApi;
// if( tempRatioHeight < 1 ){
// tempRatioHeight = 1;
// }
// var tmpX = x * tempRatioWidth;
// var tmpY = y * tempRatioHeight;
// var tmpW = w * tempRatioWidth;
// var tmpH = h * tempRatioHeight;
//
// contextObject.fillStyle = "#FFFFFF";
// contextObject.fillRect(tmpX, tmpY, tmpW+1, tmpH+1);
//
// if(aspectType == '1'){
//
// var srcImageW = imageObj.width;
// var srcImageH = imageObj.height;
// //var tmpRatioImage;
// //
// ////描画エリアが縦長か横長か
// //if( tmpW > tmpH ){
// // //横長
// //} else {
// // //縦長
// // if(srcImageW > srcImageH){
// // tmpRatioImage = tmpW / srcImageW;
// // tmpH = srcImageH * tmpRatioImage;
// // } else {
// // tmpRatioImage = tmpH / srcImageH;
// // tmpW = srcImageW * tmpRatioImage;
// // }
// //
// //}
// var drawObj = CONTENTVIEW.adjustAspectRatio(tmpX, tmpY, tmpW, tmpH, imageObj.width, imageObj.height);
// tmpX = drawObj.drawX;
// tmpY = drawObj.drawY;
// tmpW = drawObj.drawW;
// tmpH = drawObj.drawH;
//
// }
//
// contextObject.drawImage(imageObj, tmpX, tmpY, tmpW, tmpH);
// CONTENTVIEW.flip();
//};
//if (!CONTENTVIEW_GENERAL.mediaType4_changeImage[id]) CONTENTVIEW_GENERAL.mediaType4_changeImage[id] = 0;
//imageObj.src = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage].fileName;
}
};
......@@ -901,7 +907,15 @@ CONTENTVIEW_CREATEOBJECT.trigger = function (mediaType, actionType, id, imageUrl
if (CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].index == index
&& CONTENTVIEW.objType4_5[nIndex].id == target) {
if (CONTENTVIEW.objType4_5[nIndex].mediaType == '4') { /*image*/
CONTENTVIEW.changeImageType4(CONTENTVIEW.objType4_5, nIndex, nIndex1);
//#28696
CONTENTVIEW_GETDATA.getContent().currentPage.pageObjects.some(function(object) {
if (object.id == target) {
object.imageUrl = CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].fileName;
return true;
}
});
CONTENTVIEW.resizeScreen();
//CONTENTVIEW.changeImageType4(CONTENTVIEW.objType4_5, nIndex, nIndex1);
//詳細ログ用 画像なので0セット
objectLog.actionTime = "0";
//リソースID
......
......@@ -430,7 +430,7 @@ CONTENTVIEW_GENERAL.ready = function(initContentId){
CONTENTVIEW_GENERAL.nAjaxLoad = 0;
CONTENTVIEW_GENERAL.isClearDrawing = false;
CONTENTVIEW_GENERAL.isDrawing = false;
CONTENTVIEW_GENERAL.mediaType4_changeImage = 0;
CONTENTVIEW_GENERAL.mediaType4_changeImage = [];
CONTENTVIEW_GENERAL.isLoadingObject = false;
CONTENTVIEW_GENERAL.isFirstLoad = true;
CONTENTVIEW_GENERAL.nPositionCanvas = [];
......
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