Commit 40874c47 by tsushima

#28696 【Biz/Web】差し替え画像が重なって表示される

parent aac32ba2
...@@ -3801,7 +3801,7 @@ CONTENTVIEW.removeObject = function() { ...@@ -3801,7 +3801,7 @@ CONTENTVIEW.removeObject = function() {
CONTENTVIEW.playAllAudio(); CONTENTVIEW.playAllAudio();
/* mediaType = 4 */ /* mediaType = 4 */
CONTENTVIEW_GENERAL.mediaType4_changeImage = 0; CONTENTVIEW_GENERAL.mediaType4_changeImage = [];
}; };
/* View Component setDefaultEvent */ /* View Component setDefaultEvent */
...@@ -6409,8 +6409,8 @@ CONTENTVIEW.adjustAspectRatio = function(drawX, drawY, drawW, drawH, srcImageW, ...@@ -6409,8 +6409,8 @@ CONTENTVIEW.adjustAspectRatio = function(drawX, drawY, drawW, drawH, srcImageW,
//描画エリアとソース画像の比率計算 //描画エリアとソース画像の比率計算
var drawRatio = drawObj.drawH / drawObj.drawW; var drawRatio = drawObj.drawH / drawObj.drawW;
var srcRatio = srcImageH / srcImageW; var srcRatio = srcImageH / srcImageW;
console.log("drawRatio:" + drawRatio); //console.log("drawRatio:" + drawRatio);
console.log("srcRatio:" + srcRatio); //console.log("srcRatio:" + srcRatio);
if( drawRatio < srcRatio ){ if( drawRatio < srcRatio ){
tmpH = drawObj.drawH; tmpH = drawObj.drawH;
......
...@@ -473,8 +473,8 @@ CONTENTVIEW_CREATEOBJECT.PageObject.prototype.drawPageObject = function (context ...@@ -473,8 +473,8 @@ CONTENTVIEW_CREATEOBJECT.PageObject.prototype.drawPageObject = function (context
} }
else if(mediaType == '4'){ else if(mediaType == '4'){
context.fillStyle = "#FFFFFF"; //context.fillStyle = "#FFFFFF";
context.fillRect(x, y, w, h); //context.fillRect(x, y, w, h);
if(aspectType == '1'){ if(aspectType == '1'){
var drawObj = CONTENTVIEW.adjustAspectRatio(x, y, w, h, img.width, img.height); var drawObj = CONTENTVIEW.adjustAspectRatio(x, y, w, h, img.width, img.height);
x = drawObj.drawX; x = drawObj.drawX;
...@@ -784,74 +784,84 @@ CONTENTVIEW_CREATEOBJECT.listImage = function (mediaType, id, imageUrl, x, y, w, ...@@ -784,74 +784,84 @@ CONTENTVIEW_CREATEOBJECT.listImage = function (mediaType, id, imageUrl, x, y, w,
//COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog); //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 */ /* check index bigger than length object */
if (CONTENTVIEW_GENERAL.mediaType4_changeImage > (imageObjects.length - 1)) { if (CONTENTVIEW_GENERAL.mediaType4_changeImage[id] > (imageObjects.length - 1)) {
CONTENTVIEW_GENERAL.mediaType4_changeImage = 0; CONTENTVIEW_GENERAL.mediaType4_changeImage[id] = 0;
} }
//リソースIDセット //リソースIDセット
objectLog.resourceId = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage].resourceId; objectLog.resourceId = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage[id]].resourceId;
COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog); COMMON.SetObjectLog(CONTENTVIEW_GENERAL.contentID, objectLog);
//#28696
/* draw image */ CONTENTVIEW_GETDATA.getContent().currentPage.pageObjects.some(function(object) {
var imageObj = new Image(); if (object.id == id) {
imageObj.onload = function () { object.imageUrl = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage[id]].fileName;
var canvasObject = document.getElementById("offscreen"); return true;
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;
} }
});
CONTENTVIEW.resizeScreen();
contextObject.drawImage(imageObj, tmpX, tmpY, tmpW, tmpH); /* draw image */
CONTENTVIEW.flip(); //var imageObj = new Image();
}; //imageObj.onload = function () {
imageObj.src = imageObjects[CONTENTVIEW_GENERAL.mediaType4_changeImage].fileName; // 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;
} }
}; };
...@@ -897,7 +907,15 @@ CONTENTVIEW_CREATEOBJECT.trigger = function (mediaType, actionType, id, imageUrl ...@@ -897,7 +907,15 @@ CONTENTVIEW_CREATEOBJECT.trigger = function (mediaType, actionType, id, imageUrl
if (CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].index == index if (CONTENTVIEW.objType4_5[nIndex].dataObjects[nIndex1].index == index
&& CONTENTVIEW.objType4_5[nIndex].id == target) { && CONTENTVIEW.objType4_5[nIndex].id == target) {
if (CONTENTVIEW.objType4_5[nIndex].mediaType == '4') { /*image*/ 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セット //詳細ログ用 画像なので0セット
objectLog.actionTime = "0"; objectLog.actionTime = "0";
//リソースID //リソースID
......
...@@ -430,7 +430,7 @@ CONTENTVIEW_GENERAL.ready = function(initContentId){ ...@@ -430,7 +430,7 @@ CONTENTVIEW_GENERAL.ready = function(initContentId){
CONTENTVIEW_GENERAL.nAjaxLoad = 0; CONTENTVIEW_GENERAL.nAjaxLoad = 0;
CONTENTVIEW_GENERAL.isClearDrawing = false; CONTENTVIEW_GENERAL.isClearDrawing = false;
CONTENTVIEW_GENERAL.isDrawing = false; CONTENTVIEW_GENERAL.isDrawing = false;
CONTENTVIEW_GENERAL.mediaType4_changeImage = 0; CONTENTVIEW_GENERAL.mediaType4_changeImage = [];
CONTENTVIEW_GENERAL.isLoadingObject = false; CONTENTVIEW_GENERAL.isLoadingObject = false;
CONTENTVIEW_GENERAL.isFirstLoad = true; CONTENTVIEW_GENERAL.isFirstLoad = true;
CONTENTVIEW_GENERAL.nPositionCanvas = []; 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