Address issue 526 - incorporate duopixel's patch to convert touch events to mouse events.

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2085 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Will Schleter 2012-07-21 11:02:54 +00:00
parent 36e0fbd2d5
commit 7f487a89b2
3 changed files with 11 additions and 0 deletions

View File

@ -38,6 +38,7 @@ var isIE_ = userAgent.indexOf('MSIE') >= 0;
var isChrome_ = userAgent.indexOf('Chrome/') >= 0; var isChrome_ = userAgent.indexOf('Chrome/') >= 0;
var isWindows_ = userAgent.indexOf('Windows') >= 0; var isWindows_ = userAgent.indexOf('Windows') >= 0;
var isMac_ = userAgent.indexOf('Macintosh') >= 0; var isMac_ = userAgent.indexOf('Macintosh') >= 0;
var isTouch_ = 'ontouchstart' in window;
var supportsSelectors_ = (function() { var supportsSelectors_ = (function() {
return !!svg.querySelector; return !!svg.querySelector;
@ -159,6 +160,7 @@ svgedit.browser.isIE = function() { return isIE_; }
svgedit.browser.isChrome = function() { return isChrome_; } svgedit.browser.isChrome = function() { return isChrome_; }
svgedit.browser.isWindows = function() { return isWindows_; } svgedit.browser.isWindows = function() { return isWindows_; }
svgedit.browser.isMac = function() { return isMac_; } svgedit.browser.isMac = function() { return isMac_; }
svgedit.browser.isTouch = function() { return isTouch_; }
svgedit.browser.supportsSelectors = function() { return supportsSelectors_; } svgedit.browser.supportsSelectors = function() { return supportsSelectors_; }
svgedit.browser.supportsXpath = function() { return supportsXpath_; } svgedit.browser.supportsXpath = function() { return supportsXpath_; }

View File

@ -4,6 +4,8 @@
<head> <head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1"/> <meta http-equiv="X-UA-Compatible" content="chrome=1"/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<link rel="icon" type="image/png" href="images/logo.png"/> <link rel="icon" type="image/png" href="images/logo.png"/>
<link rel="stylesheet" href="jgraduate/css/jPicker.css" type="text/css"/> <link rel="stylesheet" href="jgraduate/css/jPicker.css" type="text/css"/>
<link rel="stylesheet" href="jgraduate/css/jgraduate.css" type="text/css"/> <link rel="stylesheet" href="jgraduate/css/jgraduate.css" type="text/css"/>
@ -21,6 +23,7 @@
<script type="text/javascript" src="svgicons/jquery.svgicons.js"></script> <script type="text/javascript" src="svgicons/jquery.svgicons.js"></script>
<script type="text/javascript" src="jgraduate/jquery.jgraduate.min.js"></script> <script type="text/javascript" src="jgraduate/jquery.jgraduate.min.js"></script>
<script type="text/javascript" src="spinbtn/JQuerySpinBtn.min.js"></script> <script type="text/javascript" src="spinbtn/JQuerySpinBtn.min.js"></script>
<script type="text/javascript" src="touch.js"></script>
<!--{if svg_edit_release}> <!--{if svg_edit_release}>
<script type="text/javascript" src="svgedit.compiled.js"></script> <script type="text/javascript" src="svgedit.compiled.js"></script>

View File

@ -17,6 +17,11 @@
(function() { (function() {
document.addEventListener("touchstart", touchHandler, true);
document.addEventListener("touchmove", touchHandler, true);
document.addEventListener("touchend", touchHandler, true);
document.addEventListener("touchcancel", touchHandler, true);
if(!window.svgEditor) window.svgEditor = function($) { if(!window.svgEditor) window.svgEditor = function($) {
var svgCanvas; var svgCanvas;
var Editor = {}; var Editor = {};
@ -4104,6 +4109,7 @@
var btn = $(opts.sel); var btn = $(opts.sel);
if (btn.length == 0) return true; // Skip if markup does not exist if (btn.length == 0) return true; // Skip if markup does not exist
if(opts.evt) { if(opts.evt) {
if (svgedit.browser.isTouch() && opts.evt === "click") opts.evt = "mousedown"
btn[opts.evt](opts.fn); btn[opts.evt](opts.fn);
} }