Commit 4a662e10 by Masaru Abe

chrome向けタッチパネル対応

parent 44e03834
...@@ -57,9 +57,13 @@ var UserEnvironment = function() { ...@@ -57,9 +57,13 @@ var UserEnvironment = function() {
}; };
/** check user browser */ /** check user browser */
function checkBrowser(userAgent) { function checkBrowser(userAgent) {
if(userAgent.toLowerCase().indexOf("msie") >= 0) { if(userAgent.toLowerCase().indexOf("msie") >= 0) {
return "msie"; return "msie";
} }
if(userAgent.toLowerCase().indexOf("trident") >= 0) {
return "msie";
}
if(userAgent.toLowerCase().indexOf("firefox") >= 0) { if(userAgent.toLowerCase().indexOf("firefox") >= 0) {
return "firefox"; return "firefox";
} }
...@@ -72,6 +76,7 @@ var UserEnvironment = function() { ...@@ -72,6 +76,7 @@ var UserEnvironment = function() {
if(userAgent.toLowerCase().indexOf("opera") >= 0) { if(userAgent.toLowerCase().indexOf("opera") >= 0) {
return "opera"; return "opera";
} }
return "unknown"; return "unknown";
}; };
}; };
......
...@@ -2808,7 +2808,6 @@ function isTouchDevice() { ...@@ -2808,7 +2808,6 @@ function isTouchDevice() {
if (is_touch_device) { if (is_touch_device) {
return true; return true;
} }
return false; return false;
}; };
......
...@@ -1137,8 +1137,22 @@ function drawOnCanvas() { ...@@ -1137,8 +1137,22 @@ function drawOnCanvas() {
tool = new tool_drawing(); tool = new tool_drawing();
if (isTouchDevice() == true) { if (isTouchDevice() == true) {
initializeCanvas(document.getElementById('draw_canvas')); initializeCanvas(document.getElementById('draw_canvas'));
initializeCanvas(document.getElementById('marker_canvas')); initializeCanvas(document.getElementById('marker_canvas'));
//iOSかAndroid以外ならmarkerではmouseも発火させる
if(avwUserEnvObj.os != "ipad" && avwUserEnvObj.os != "android"){
//draw_canvas
canvas_draw.addEventListener('mousedown', ev_canvas, false);
canvas_draw.addEventListener('mousemove', ev_canvas, false);
canvas_draw.addEventListener('mouseup', ev_canvas, false);
canvas_draw.addEventListener('mouseout', ev_canvas, false);
//marker_canvas
canvas_marker.addEventListener('mousedown', ev_canvas, false);
canvas_marker.addEventListener('mousemove', ev_canvas, false);
canvas_marker.addEventListener('mouseup', ev_canvas, false);
canvas_marker.addEventListener('mouseout', ev_canvas, false);
}
} }
else { else {
// Attach the mousedown, mousemove and mouseup event listeners. // Attach the mousedown, mousemove and mouseup event listeners.
...@@ -1558,6 +1572,7 @@ function tool_drawing() { ...@@ -1558,6 +1572,7 @@ function tool_drawing() {
}; };
this.mousemove = function (ev) { this.mousemove = function (ev) {
ev.preventDefault();
if (isAddingMarking == true) { if (isAddingMarking == true) {
if ($("#marker_canvas").is(":hidden")) { if ($("#marker_canvas").is(":hidden")) {
drawMouseMove(context_draw, ev); drawMouseMove(context_draw, ev);
...@@ -3643,11 +3658,12 @@ function removeObject() { ...@@ -3643,11 +3658,12 @@ function removeObject() {
/* View Component setDefaultEvent */ /* View Component setDefaultEvent */
function setDefaultEvent() { function setDefaultEvent() {
//alert("setDefaultEvent");
var canvasPre = document.getElementById('mainPre'); var canvasPre = document.getElementById('mainPre');
var canvasNext = document.getElementById('mainNext'); var canvasNext = document.getElementById('mainNext');
//mouse event //mouse event
// add event for wrap // add event for wrap
//remove wrapper event //remove wrapper event
canvasPre.removeEventListener('mousedown',function(){},false); canvasPre.removeEventListener('mousedown',function(){},false);
...@@ -3660,7 +3676,6 @@ function setDefaultEvent() { ...@@ -3660,7 +3676,6 @@ function setDefaultEvent() {
canvasNext.removeEventListener('mouseup',function(){},false); canvasNext.removeEventListener('mouseup',function(){},false);
canvasNext.removeEventListener('mouseout',function(){},false); canvasNext.removeEventListener('mouseout',function(){},false);
document.getElementById('main').addEventListener('click', onClick_CanvasMain, false); document.getElementById('main').addEventListener('click', onClick_CanvasMain, false);
document.getElementById('divCheckExistMarking').addEventListener('click', onClick_CanvasMain, false); document.getElementById('divCheckExistMarking').addEventListener('click', onClick_CanvasMain, false);
...@@ -3669,12 +3684,32 @@ function setDefaultEvent() { ...@@ -3669,12 +3684,32 @@ function setDefaultEvent() {
document.getElementById('main').addEventListener('mousemove', mouseMove_canvasMain, false); document.getElementById('main').addEventListener('mousemove', mouseMove_canvasMain, false);
document.getElementById('main').addEventListener('mouseup', mouseUp_CanvasMain, false); document.getElementById('main').addEventListener('mouseup', mouseUp_CanvasMain, false);
if ($.browser.msie ) { if (avwUserEnvObj.browser == 'msie') {
_bWin8TouchEnabled = window.navigator.msPointerEnabled; _bWin8TouchEnabled = window.navigator.msPointerEnabled;
} else {
if( isTouchDevice ){
document.getElementById('main').addEventListener('touchstart', onTouchstart, false);
document.getElementById('main').addEventListener('touchmove', onTouchmove, false);
document.getElementById('main').addEventListener('touchend', onTouchend, false);
//iPad&Andの実装から
document.getElementById('canvasWrapper').addEventListener('touchstart', function(event){console.log('canvasWrapper:touchstart');event.preventDefault();}, false);
document.getElementById('canvasWrapper').addEventListener('touchmove', function(event){event.preventDefault();}, false);
document.getElementById('canvasWrapper').addEventListener('touchend', function(event){event.preventDefault();}, false);
document.getElementById('overlay').addEventListener('touchstart', function(event){console.log('overlay:touchstart');event.preventDefault(); return false;}, false);
document.getElementById('overlay').addEventListener('touchmove', function(event){event.preventDefault(); return false;}, false);
document.getElementById('overlay').addEventListener('touchend', function(event){event.preventDefault(); return false;}, false);
//デフォルトのD&Dが効いてしまう問題回避
document.getElementById('button_next_canvas').addEventListener('touchstart', function(event){event.preventDefault();}, false);
document.getElementById('button_next_canvas').addEventListener('touchmove', function(event){event.preventDefault();}, false);
document.getElementById('button_next_canvas').addEventListener('touchend', function(event){event.preventDefault();}, false);
document.getElementById('button_pre_canvas').addEventListener('touchstart', function(event){event.preventDefault();}, false);
document.getElementById('button_pre_canvas').addEventListener('touchmove', function(event){event.preventDefault();}, false);
document.getElementById('button_pre_canvas').addEventListener('touchend', function(event){event.preventDefault();}, false);
}
} }
if(_bWin8TouchEnabled){ if(_bWin8TouchEnabled){
document.getElementById('main').addEventListener('MSPointerDown', onTouchstart, false); document.getElementById('main').addEventListener('MSPointerDown', onTouchstart, false);
document.getElementById('main').addEventListener('MSPointerMove', onTouchmove, false); document.getElementById('main').addEventListener('MSPointerMove', onTouchmove, false);
document.getElementById('main').addEventListener('MSPointerUp', onTouchend, false); document.getElementById('main').addEventListener('MSPointerUp', onTouchend, false);
......
/// <reference path="../common/js/jquery-ui-1.8.23.custom.min.js" /> /// <reference path="../common/js/jquery-ui-1.8.23.custom.min.js" />
/// <reference path="../common/js/common.js" /> /// <reference path="../common/js/common.js" />
/// <reference path="contentview_VarDef.js" /> /// <reference path="contentview_VarDef.js" />
/// <reference path="contentview_CallApi.js" /> /// <reference path="contentview_CallApi.js" />
/// <reference path="contentview_GetData.js" /> /// <reference path="contentview_GetData.js" />
/// <reference path="contentview_InitObjects.js" /> /// <reference path="contentview_InitObjects.js" />
/* add memo click */ /* add memo click */
function handleAddMemo(event) { function handleAddMemo(event) {
...@@ -962,10 +955,12 @@ function onClick_CanvasMain(event) { ...@@ -962,10 +955,12 @@ function onClick_CanvasMain(event) {
function mouseMove_canvasMain(event) { function mouseMove_canvasMain(event) {
event.preventDefault();
//Start Function : No.20 - Editor : Long //Start Function : No.20 - Editor : Long
if(_isTouching){ if(_isTouching){
//_isTouching = false; //_isTouching = false;
return; return;
} }
if(ClientData.IsAddingMarking() == true){ if(ClientData.IsAddingMarking() == true){
...@@ -977,7 +972,7 @@ function mouseMove_canvasMain(event) { ...@@ -977,7 +972,7 @@ function mouseMove_canvasMain(event) {
} }
//End Function : No.20 - Editor : Long //End Function : No.20 - Editor : Long
event.preventDefault(); //event.preventDefault();
/* base image move when userScale over 1 */ /* base image move when userScale over 1 */
if (moveFlag && userScale != 1) { if (moveFlag && userScale != 1) {
...@@ -1143,9 +1138,12 @@ function mouseMove_canvasMain(event) { ...@@ -1143,9 +1138,12 @@ function mouseMove_canvasMain(event) {
}; };
function mouseDown_CanvasMain(event) { function mouseDown_CanvasMain(event) {
event.preventDefault();
//Start Function : No.20 - Editor : Long - Date: 08/17/2013 - Summary : //Start Function : No.20 - Editor : Long - Date: 08/17/2013 - Summary :
if(_isTouching){ if(_isTouching){
//_isTouching = false; // //_isTouching = false;
return; return;
} }
...@@ -1162,7 +1160,7 @@ function mouseDown_CanvasMain(event) { ...@@ -1162,7 +1160,7 @@ function mouseDown_CanvasMain(event) {
moveFlag = false; moveFlag = false;
} }
event.preventDefault(); //event.preventDefault();
$('#main').css('cursor', 'default'); $('#main').css('cursor', 'default');
...@@ -1213,12 +1211,10 @@ function mouseDown_CanvasMain(event) { ...@@ -1213,12 +1211,10 @@ function mouseDown_CanvasMain(event) {
//End Function : No.9 - Editor : Long - Date : 08/16/2013 - Summary: //End Function : No.9 - Editor : Long - Date : 08/16/2013 - Summary:
} }
else { else {
//event.preventDefault(); //event.preventDefault();
px = event.targetTouches[0].pageX; px = event.targetTouches[0].pageX;
py = event.targetTouches[0].pageY; py = event.targetTouches[0].pageY;
} }
}; };
function mouseUp_CanvasMain(event) { function mouseUp_CanvasMain(event) {
...@@ -1372,34 +1368,43 @@ function resetNaviAction(){ ...@@ -1372,34 +1368,43 @@ function resetNaviAction(){
function onTouchstart(evt){ function onTouchstart(evt){
evt.preventDefault();
if(ClientData.IsAddingMarking() == true){ if(ClientData.IsAddingMarking() == true){
return; return;
} }
var bContinue = true; var bContinue = true;
if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") { //if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
evt.preventDefault(); // evt.preventDefault();
} //}
//if( isTouchDevice ){
// evt.preventDefault();
//}
if(isLoadingObject){ if(isLoadingObject){
bContinue = false; bContinue = false;
} }
switch (evt.pointerType) { if( evt.pointerType != null ){
case evt.MSPOINTER_TYPE_TOUCH: //evt.pointerType は IE以外 undef
_isTouching = true; switch (evt.pointerType) {
break; case evt.MSPOINTER_TYPE_TOUCH:
case evt.MSPOINTER_TYPE_PEN: _isTouching = true;
bContinue = false; break;
break; case evt.MSPOINTER_TYPE_PEN:
case evt.MSPOINTER_TYPE_MOUSE: bContinue = false;
_isTouching = false; break;
bContinue = false; case evt.MSPOINTER_TYPE_MOUSE:
break; _isTouching = false;
bContinue = false;
break;
}
} else {
_isTouching = true;
} }
if(!bContinue){ if(!bContinue){
return; return;
} }
...@@ -1412,7 +1417,8 @@ function onTouchstart(evt){ ...@@ -1412,7 +1417,8 @@ function onTouchstart(evt){
_touchLastPos = null; _touchLastPos = null;
_touchFirstPos = null; _touchFirstPos = null;
if(_bWin8TouchEnabled){ if(_bWin8TouchEnabled){
_bufferPoints = []; _bufferPoints = [];
if(_startPoints.length == 0){ if(_startPoints.length == 0){
// start navi page case // start navi page case
...@@ -1420,7 +1426,7 @@ function onTouchstart(evt){ ...@@ -1420,7 +1426,7 @@ function onTouchstart(evt){
_startPoints.push(touch1); _startPoints.push(touch1);
if(userScale != 1){ if(userScale != 1){
px = evt.pageX; px = evt.pageX;
py = evt.pageY; py = evt.pageY;
} }
else{ else{
touchDownFirstPosX = evt.clientX; touchDownFirstPosX = evt.clientX;
...@@ -1493,20 +1499,19 @@ function onTouchstart(evt){ ...@@ -1493,20 +1499,19 @@ function onTouchstart(evt){
// not is win 8 touch event // not is win 8 touch event
touch1 = evt.touches[0]; touch1 = evt.touches[0];
touch2 = evt.touches[1]; touch2 = evt.touches[1];
if(touch2 == null){ if(touch2 == null){
_isClick = true; _isClick = true;
_touchPageX = evt.touches[0].pageX; _touchPageX = evt.touches[0].pageX;
_touchPageY = evt.touches[0].pageY; _touchPageY = evt.touches[0].pageY;
//set touch to move page flag //set touch to move page flag
if(touch2 == null && userScale == 1){ if(userScale == 1){
if(animateType == animateTypeKeys.Type_Slide){ if(animateType == animateTypeKeys.Type_Slide){
$('#mainPre').css("display",'block'); $('#mainPre').css("display",'block');
$('#mainNext').css("display",'block'); $('#mainNext').css("display",'block');
} }
_isPageNaviTouch = true; _isPageNaviTouch = true;
_moveNum = 0; _moveNum = 0;
touchStartedTime = new Date(); touchStartedTime = new Date();
...@@ -1546,12 +1551,16 @@ function onTouchstart(evt){ ...@@ -1546,12 +1551,16 @@ function onTouchstart(evt){
} }
//End Function : No.9 - Editor : Long - Date : 08/16/2013 - Summary: //End Function : No.9 - Editor : Long - Date : 08/16/2013 - Summary:
} }
else if(touch2 == null && userScale != 1){ else if(userScale != 1){
_isPageNaviTouch = false; _isPageNaviTouch = false;
px = evt.pageX; //px = evt.pageX;
py = evt.pageY; //py = evt.pageY;
//試験
px = evt.touches[0].pageX;
py = evt.touches[0].pageY;
} }
else { else {
//ここにこない
_isPageNaviTouch = false; _isPageNaviTouch = false;
} }
...@@ -1597,6 +1606,8 @@ var isPreventClick = false; ...@@ -1597,6 +1606,8 @@ var isPreventClick = false;
function onTouchmove(evt){ function onTouchmove(evt){
evt.preventDefault();
if(ClientData.IsAddingMarking() == true){ if(ClientData.IsAddingMarking() == true){
return; return;
} }
...@@ -1605,27 +1616,32 @@ function onTouchmove(evt){ ...@@ -1605,27 +1616,32 @@ function onTouchmove(evt){
if(isLoadingObject){ if(isLoadingObject){
bContinue = false; bContinue = false;
} }
switch (evt.pointerType) { if( evt.pointerType != null ){
case evt.MSPOINTER_TYPE_TOUCH: //evt.pointerType は IE以外 undef
_isTouching = true; switch (evt.pointerType) {
break; case evt.MSPOINTER_TYPE_TOUCH:
case evt.MSPOINTER_TYPE_PEN: _isTouching = true;
bContinue = false; break;
break; case evt.MSPOINTER_TYPE_PEN:
case evt.MSPOINTER_TYPE_MOUSE: bContinue = false;
_isTouching = false; break;
bContinue = false; case evt.MSPOINTER_TYPE_MOUSE:
break; _isTouching = false;
bContinue = false;
break;
}
} else {
_isTouching = true;
} }
if(!bContinue){ if(!bContinue){
return; return;
}
if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
evt.preventDefault();
} }
//if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
// evt.preventDefault();
//}
var touch1 = null; var touch1 = null;
var touch2 = null; var touch2 = null;
...@@ -1868,6 +1884,8 @@ function onTouchmove(evt){ ...@@ -1868,6 +1884,8 @@ function onTouchmove(evt){
function onTouchend(evt){ function onTouchend(evt){
evt.preventDefault();
if(ClientData.IsAddingMarking() == true){ if(ClientData.IsAddingMarking() == true){
return; return;
} }
...@@ -1878,27 +1896,33 @@ function onTouchend(evt){ ...@@ -1878,27 +1896,33 @@ function onTouchend(evt){
bContinue = false; bContinue = false;
} }
switch (evt.pointerType) { if( evt.pointerType != null ){
case evt.MSPOINTER_TYPE_TOUCH: //evt.pointerType は IE以外 undef
_isTouching = true; switch (evt.pointerType) {
break; case evt.MSPOINTER_TYPE_TOUCH:
case evt.MSPOINTER_TYPE_PEN: _isTouching = true;
_isTouching = false; break;
bContinue = false; case evt.MSPOINTER_TYPE_PEN:
break; _isTouching = false;
case evt.MSPOINTER_TYPE_MOUSE: bContinue = false;
_isTouching = false; break;
bContinue = false; case evt.MSPOINTER_TYPE_MOUSE:
break; _isTouching = false;
bContinue = false;
break;
}
} else {
//タッチ操作終了
_isTouching = false;
} }
if(!bContinue){ if(!bContinue){
return; return;
} }
if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") { //if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
evt.preventDefault(); // evt.preventDefault();
} //}
_lastScaleDelta = userScale -1; _lastScaleDelta = userScale -1;
if(_bWin8TouchEnabled){ if(_bWin8TouchEnabled){
......
...@@ -500,12 +500,3 @@ $(function () { ...@@ -500,12 +500,3 @@ $(function () {
/// =============================================================================================== /// ===============================================================================================
...@@ -1121,6 +1121,9 @@ function viewLinkContentById(contentId){ ...@@ -1121,6 +1121,9 @@ function viewLinkContentById(contentId){
return; return;
} }
window.open(linkUrl, "_blank", "new window, scrollbars=yes");
/*
//httpで始まる場合は別ウィンドウで開く //httpで始まる場合は別ウィンドウで開く
if (linkUrl.toLowerCase().indexOf('http') === 0) { if (linkUrl.toLowerCase().indexOf('http') === 0) {
window.open(linkUrl, "_blank", "new window, scrollbars=yes"); window.open(linkUrl, "_blank", "new window, scrollbars=yes");
...@@ -1140,7 +1143,7 @@ function viewLinkContentById(contentId){ ...@@ -1140,7 +1143,7 @@ function viewLinkContentById(contentId){
window.open(linkUrl); //open url to download file on orther browser window.open(linkUrl); //open url to download file on orther browser
} }
} }
*/
}, },
function (xhr, b, c) { }); function (xhr, b, c) { });
}; };
......
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