Commit d45fb58d by Masaru Abe

拡大イベント対応

parent ebc197e9
......@@ -2404,7 +2404,6 @@ function SetObjectLog( strContentId, objectLog ){
for(var nIndex = 0; nIndex < arrContentLogs.length; nIndex++) {
if(arrContentLogs[nIndex].contentid == strContentId) {
//ObjectLog追加
arrContentLogs[nIndex].objectLogArray.push(objectLog);
......@@ -2437,6 +2436,7 @@ function SetObjectLogActionTime( strContentId, objectId, actionTime ){
Register reading log of content to server by calling api
*/
function RegisterLog() {
var arrContentLogs = ClientData.ContentLogData();
var isError = false;
......@@ -2498,11 +2498,12 @@ function RegisterLog() {
pageLogJson = "{ header:[\"pageNo\",\"readingStartDate\",\"readingEndDate\",\"readingTime\"],lines:";
pageLogJson = pageLogJson + JSON.stringify( lines );
pageLogJson = pageLogJson + "}";
//alert("JSON:" + pageLogJson);
//console.log("JSON:" + pageLogJson);
}
}
var objectLogArray = arrContentLogs[nIndex].objectLogArray;
//詳細ログオプションが有効ならページ閲覧ログデータ作成
if( objectLogArray.length > 0 ){
......@@ -2514,7 +2515,7 @@ function RegisterLog() {
actionDate = new Date(objectLogArray[nIndex2].actionDate);
var line = [];
if( objectLogArray[nIndex2].objectId ){
if( objectLogArray[nIndex2].objectId != null ){
line.push(actionDate.jpDateTimeString1());
line.push(objectLogArray[nIndex2].pageNo);
line.push(objectLogArray[nIndex2].objectId);
......@@ -2527,18 +2528,25 @@ function RegisterLog() {
line.push(objectLogArray[nIndex2].locationY);
line.push(objectLogArray[nIndex2].locationHeight);
line.push(objectLogArray[nIndex2].locationWidth);
if( objectLogArray[nIndex2].eventType != null ){
line.push(objectLogArray[nIndex2].eventType);
} else {
line.push("");
}
lines.push(line);
//alert("ObjectLog Line:" + JSON.stringify( line ) );
//console.log("ObjectLog Line:" + JSON.stringify( line ) );
}
}
//alert("ObjectLog Lines:" + JSON.stringify( lines ) );
//console.log("ObjectLog Lines:" + JSON.stringify( lines ) );
if( lines.length > 0 ){
objectLogJson = "{ header:[\"actionDate\",\"pageNo\",\"objectId\",\"resourceId\",\"mediaType\",\"actionType\",\"actionValue\",\"actionTime\",\"locationX\",\"locationY\",\"locationHeight\",\"locationWidth\"],";
objectLogJson = "{ header:[\"actionDate\",\"pageNo\",\"objectId\",\"resourceId\",\"mediaType\",\"actionType\",\"actionValue\",\"actionTime\",\"locationX\",\"locationY\",\"locationHeight\",\"locationWidth\",\"eventType\"],";
objectLogJson = objectLogJson + "lines:";
objectLogJson = objectLogJson + JSON.stringify( lines );
objectLogJson = objectLogJson + "}";
//alert("JSON:" + objectLogJson);
//console.log("JSON:" + objectLogJson);
}
}
......
......@@ -3566,6 +3566,7 @@ var isDestPositionDetect = false;
var destPosX = 0, destPosY = 0;
var moveX = 0, moveY = 0;
var userScale = 1;
var userScaleNow = 1;
var scaleDelta = 0.5;
var scaleX, scaleY;
var canvasObject;
......@@ -5316,6 +5317,7 @@ function screenFit() {
context_main.clearRect(0, 0, canvas_main.width, canvas_main.height);
srcRect = new Rect(0, 0, offScreen.width, offScreen.height);
userScale = 1;
userScaleNow = 1;
moveX = 0;
moveY = 0;
......@@ -5343,6 +5345,14 @@ function screenFit() {
/* change Scale screen*/
function changeScale(scale) {
//拡大か判定
var isZoom = false;
if( userScaleNow < scale ){
isZoom = true;
}
userScaleNow = scale;
var canvas = document.getElementById('main');
var offScreen = document.getElementById('offscreen');
......@@ -5415,6 +5425,62 @@ function changeScale(scale) {
srcRect.bottom = Math.round(srcRect.top + sh);
srcRect.width = srcRect.right - srcRect.left;
srcRect.height = srcRect.bottom - srcRect.top;
if( isZoom ){
//var tempRatioWidth = offScreen.width / widthEachPageApi;
var tempRatioWidth = widthEachPageApi / offScreen.width;
if( tempRatioWidth > 1 ){
tempRatioWidth = 1;
}
//var tempRatioHeight = offScreen.height / heightEachPageApi;
var tempRatioHeight = heightEachPageApi / offScreen.height;
if( tempRatioHeight > 1 ){
tempRatioHeight = 1;
}
var tmpX = 0;
var tmpY = 0;
if( srcRect.top > 0 ){
tmpX = Math.round(srcRect.top * tempRatioWidth);
}
if( srcRect.left > 0 ){
tmpY = Math.round(srcRect.left * tempRatioHeight);
}
var tmpW = Math.round(srcRect.width * tempRatioWidth);
var tmpH = Math.round(srcRect.height * tempRatioHeight);
var zoomX = tmpX + Math.round( tmpH / 2 );
var zoomY = tmpY + Math.round( tmpW / 2 );
//console.log("tempRatio.width:height " + tempRatioWidth + "," + tempRatioHeight);
//console.log("srcRect.left:top " + srcRect.left + "," + srcRect.top);
//console.log("srcRect.width:height " + srcRect.width + "," + srcRect.height);
//console.log("tmpX.Y " + tmpX + "," + tmpY);
//console.log("tmpW.H " + tmpW + "," + tmpH);
//console.log("zoomX.Y " + zoomX + "," + zoomY);
//詳細ログ作成
var objectLog = new ObjectLogEntity();
objectLog.contentid = contentID;
objectLog.pageNo = getPageIndex() + 1; //0始まりのページ番号
objectLog.objectId = 0;
objectLog.resourceId = "";
objectLog.mediaType = "";
objectLog.actionType = "101"; //拡大アクション定数
objectLog.actionValue = "";
objectLog.actionTime = "0";
objectLog.locationX = zoomX;
objectLog.locationY = zoomY;
objectLog.locationHeight = "";
objectLog.locationWidth = "";
objectLog.eventType = "5"; //暫定でピンチアウト
SetObjectLog(contentID, objectLog);
//---
}
};
/* change Scale screen*/
function changeScaleDrawCanvas(scale) {
......
......@@ -2028,6 +2028,7 @@ Transition.prototype.flipToPage = function (index) {
});
//change pageIndex and image bookmark
userScale = 1;
userScaleNow = 1;
//START TRB00097
//changeScale(userScale);
srcRect = new Rect(0, 0, 0, 0);
......
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