Commit 42340e57 by Masaru Abe

#12340 Chrome FireFoxでタッチ操作が出来ない

parent b446ac6a
......@@ -60,6 +60,9 @@ var UserEnvironment = function() {
if(userAgent.toLowerCase().indexOf("msie") >= 0) {
return "msie";
}
if(userAgent.toLowerCase().indexOf("trident") >= 0) {
return "msie";
}
if(userAgent.toLowerCase().indexOf("firefox") >= 0) {
return "firefox";
}
......
......@@ -1137,8 +1137,22 @@ function drawOnCanvas() {
tool = new tool_drawing();
if (isTouchDevice() == true) {
initializeCanvas(document.getElementById('draw_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 {
// Attach the mousedown, mousemove and mouseup event listeners.
......@@ -1558,6 +1572,7 @@ function tool_drawing() {
};
this.mousemove = function (ev) {
ev.preventDefault();
if (isAddingMarking == true) {
if ($("#marker_canvas").is(":hidden")) {
drawMouseMove(context_draw, ev);
......@@ -3669,12 +3684,32 @@ function setDefaultEvent() {
document.getElementById('main').addEventListener('mousemove', mouseMove_canvasMain, false);
document.getElementById('main').addEventListener('mouseup', mouseUp_CanvasMain, false);
if ($.browser.msie ) {
if (avwUserEnvObj.browser == 'msie') {
_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){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){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){
document.getElementById('main').addEventListener('MSPointerDown', onTouchstart, false);
document.getElementById('main').addEventListener('MSPointerMove', onTouchmove, false);
document.getElementById('main').addEventListener('MSPointerUp', onTouchend, false);
......
......@@ -962,6 +962,8 @@ function onClick_CanvasMain(event) {
function mouseMove_canvasMain(event) {
event.preventDefault();
//Start Function : No.20 - Editor : Long
if(_isTouching){
//_isTouching = false;
......@@ -977,7 +979,7 @@ function mouseMove_canvasMain(event) {
}
//End Function : No.20 - Editor : Long
event.preventDefault();
//event.preventDefault();
/* base image move when userScale over 1 */
if (moveFlag && userScale != 1) {
......@@ -1143,9 +1145,12 @@ function mouseMove_canvasMain(event) {
};
function mouseDown_CanvasMain(event) {
event.preventDefault();
//Start Function : No.20 - Editor : Long - Date: 08/17/2013 - Summary :
if(_isTouching){
//_isTouching = false;
// //_isTouching = false;
return;
}
......@@ -1162,7 +1167,7 @@ function mouseDown_CanvasMain(event) {
moveFlag = false;
}
event.preventDefault();
//event.preventDefault();
$('#main').css('cursor', 'default');
......@@ -1213,9 +1218,7 @@ function mouseDown_CanvasMain(event) {
//End Function : No.9 - Editor : Long - Date : 08/16/2013 - Summary:
}
else {
//event.preventDefault();
px = event.targetTouches[0].pageX;
py = event.targetTouches[0].pageY;
}
......@@ -1372,20 +1375,27 @@ function resetNaviAction(){
function onTouchstart(evt){
evt.preventDefault();
if(ClientData.IsAddingMarking() == true){
return;
}
var bContinue = true;
if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
evt.preventDefault();
}
//if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
// evt.preventDefault();
//}
//if( isTouchDevice ){
// evt.preventDefault();
//}
if(isLoadingObject){
bContinue = false;
}
if( evt.pointerType != null ){
//evt.pointerType は IE以外 undef
switch (evt.pointerType) {
case evt.MSPOINTER_TYPE_TOUCH:
_isTouching = true;
......@@ -1398,7 +1408,9 @@ function onTouchstart(evt){
bContinue = false;
break;
}
} else {
_isTouching = true;
}
if(!bContinue){
return;
......@@ -1413,6 +1425,7 @@ function onTouchstart(evt){
_touchFirstPos = null;
if(_bWin8TouchEnabled){
_bufferPoints = [];
if(_startPoints.length == 0){
// start navi page case
......@@ -1499,14 +1512,13 @@ function onTouchstart(evt){
_touchPageX = evt.touches[0].pageX;
_touchPageY = evt.touches[0].pageY;
//set touch to move page flag
if(touch2 == null && userScale == 1){
if(userScale == 1){
if(animateType == animateTypeKeys.Type_Slide){
$('#mainPre').css("display",'block');
$('#mainNext').css("display",'block');
}
_isPageNaviTouch = true;
_moveNum = 0;
touchStartedTime = new Date();
......@@ -1546,12 +1558,16 @@ function onTouchstart(evt){
}
//End Function : No.9 - Editor : Long - Date : 08/16/2013 - Summary:
}
else if(touch2 == null && userScale != 1){
else if(userScale != 1){
_isPageNaviTouch = false;
px = evt.pageX;
py = evt.pageY;
//px = evt.pageX;
//py = evt.pageY;
//試験
px = evt.touches[0].pageX;
py = evt.touches[0].pageY;
}
else {
//ここにこない
_isPageNaviTouch = false;
}
......@@ -1597,6 +1613,8 @@ var isPreventClick = false;
function onTouchmove(evt){
evt.preventDefault();
if(ClientData.IsAddingMarking() == true){
return;
}
......@@ -1606,6 +1624,8 @@ function onTouchmove(evt){
bContinue = false;
}
if( evt.pointerType != null ){
//evt.pointerType は IE以外 undef
switch (evt.pointerType) {
case evt.MSPOINTER_TYPE_TOUCH:
_isTouching = true;
......@@ -1618,14 +1638,17 @@ function onTouchmove(evt){
bContinue = false;
break;
}
} else {
_isTouching = true;
}
if(!bContinue){
return;
}
if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
evt.preventDefault();
}
//if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
// evt.preventDefault();
//}
var touch1 = null;
var touch2 = null;
......@@ -1868,6 +1891,8 @@ function onTouchmove(evt){
function onTouchend(evt){
evt.preventDefault();
if(ClientData.IsAddingMarking() == true){
return;
}
......@@ -1878,6 +1903,8 @@ function onTouchend(evt){
bContinue = false;
}
if( evt.pointerType != null ){
//evt.pointerType は IE以外 undef
switch (evt.pointerType) {
case evt.MSPOINTER_TYPE_TOUCH:
_isTouching = true;
......@@ -1891,14 +1918,18 @@ function onTouchend(evt){
bContinue = false;
break;
}
} else {
//タッチ操作終了
_isTouching = false;
}
if(!bContinue){
return;
}
if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
evt.preventDefault();
}
//if (avwUserEnvObj.os == "ipad" || avwUserEnvObj.os == "android") {
// evt.preventDefault();
//}
_lastScaleDelta = userScale -1;
if(_bWin8TouchEnabled){
......
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