Commit 4a662e10 by Masaru Abe

chrome向けタッチパネル対応

parent 44e03834
......@@ -57,9 +57,13 @@ var UserEnvironment = function() {
};
/** check user browser */
function checkBrowser(userAgent) {
if(userAgent.toLowerCase().indexOf("msie") >= 0) {
return "msie";
}
if(userAgent.toLowerCase().indexOf("trident") >= 0) {
return "msie";
}
if(userAgent.toLowerCase().indexOf("firefox") >= 0) {
return "firefox";
}
......@@ -72,6 +76,7 @@ var UserEnvironment = function() {
if(userAgent.toLowerCase().indexOf("opera") >= 0) {
return "opera";
}
return "unknown";
};
};
......
......@@ -2808,7 +2808,6 @@ function isTouchDevice() {
if (is_touch_device) {
return true;
}
return false;
};
......
......@@ -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);
......@@ -3643,6 +3658,7 @@ function removeObject() {
/* View Component setDefaultEvent */
function setDefaultEvent() {
//alert("setDefaultEvent");
var canvasPre = document.getElementById('mainPre');
var canvasNext = document.getElementById('mainNext');
......@@ -3660,7 +3676,6 @@ function setDefaultEvent() {
canvasNext.removeEventListener('mouseup',function(){},false);
canvasNext.removeEventListener('mouseout',function(){},false);
document.getElementById('main').addEventListener('click', onClick_CanvasMain, false);
document.getElementById('divCheckExistMarking').addEventListener('click', onClick_CanvasMain, false);
......@@ -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){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){
document.getElementById('main').addEventListener('MSPointerDown', onTouchstart, false);
document.getElementById('main').addEventListener('MSPointerMove', onTouchmove, false);
document.getElementById('main').addEventListener('MSPointerUp', onTouchend, false);
......
/// <reference path="../common/js/jquery-ui-1.8.23.custom.min.js" />
/// <reference path="../common/js/common.js" />
/// <reference path="contentview_VarDef.js" />
/// <reference path="contentview_CallApi.js" />
/// <reference path="contentview_GetData.js" />
/// <reference path="contentview_InitObjects.js" />
/* add memo click */
function handleAddMemo(event) {
......@@ -962,6 +955,8 @@ function onClick_CanvasMain(event) {
function mouseMove_canvasMain(event) {
event.preventDefault();
//Start Function : No.20 - Editor : Long
if(_isTouching){
//_isTouching = false;
......@@ -977,7 +972,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 +1138,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 +1160,7 @@ function mouseDown_CanvasMain(event) {
moveFlag = false;
}
event.preventDefault();
//event.preventDefault();
$('#main').css('cursor', 'default');
......@@ -1213,9 +1211,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 +1368,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 +1401,9 @@ function onTouchstart(evt){
bContinue = false;
break;
}
} else {
_isTouching = true;
}
if(!bContinue){
return;
......@@ -1413,6 +1418,7 @@ function onTouchstart(evt){
_touchFirstPos = null;
if(_bWin8TouchEnabled){
_bufferPoints = [];
if(_startPoints.length == 0){
// start navi page case
......@@ -1499,14 +1505,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 +1551,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 +1606,8 @@ var isPreventClick = false;
function onTouchmove(evt){
evt.preventDefault();
if(ClientData.IsAddingMarking() == true){
return;
}
......@@ -1606,6 +1617,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 +1631,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 +1884,8 @@ function onTouchmove(evt){
function onTouchend(evt){
evt.preventDefault();
if(ClientData.IsAddingMarking() == true){
return;
}
......@@ -1878,6 +1896,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 +1911,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){
......
......@@ -500,12 +500,3 @@ $(function () {
/// ===============================================================================================
......@@ -1121,6 +1121,9 @@ function viewLinkContentById(contentId){
return;
}
window.open(linkUrl, "_blank", "new window, scrollbars=yes");
/*
//httpで始まる場合は別ウィンドウで開く
if (linkUrl.toLowerCase().indexOf('http') === 0) {
window.open(linkUrl, "_blank", "new window, scrollbars=yes");
......@@ -1140,7 +1143,7 @@ function viewLinkContentById(contentId){
window.open(linkUrl); //open url to download file on orther browser
}
}
*/
},
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