2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

update to jscolor-1.4.2, touchmove event fix

git-svn-id: https://svn.fhem.de/fhem/trunk@4320 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2013-12-03 19:45:19 +00:00
parent c8b0d369b8
commit a411e2427c

View File

@ -1,12 +1,11 @@
/** /**
* jscolor, JavaScript Color Picker * jscolor, JavaScript Color Picker
* *
* @version 1.4.1 * @version 1.4.2
* @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html * @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
* @author Jan Odvarko, http://odvarko.cz * @author Jan Odvarko, http://odvarko.cz
* @created 2008-06-15 * @created 2008-06-15
* @updated 2013-04-08 * @updated 2013-11-25
* @added 2013-04-23 added setColor for fhem (justme1968)
* @link http://jscolor.com * @link http://jscolor.com
*/ */
@ -629,7 +628,7 @@ var jscolor = {
} }
}; };
if('ontouchstart' in window) { // if touch device if('ontouchstart' in window) { // if touch device
p.box.addEventListener('touchmove', function(e) { var handle_touchmove = function(e) {
var event={ var event={
'offsetX': e.touches[0].pageX-touchOffset.X, 'offsetX': e.touches[0].pageX-touchOffset.X,
'offsetY': e.touches[0].pageY-touchOffset.Y 'offsetY': e.touches[0].pageY-touchOffset.Y
@ -641,7 +640,9 @@ var jscolor = {
} }
e.stopPropagation(); // prevent move "view" on broswer e.stopPropagation(); // prevent move "view" on broswer
e.preventDefault(); // prevent Default - Android Fix (else android generated only 1-2 touchmove events) e.preventDefault(); // prevent Default - Android Fix (else android generated only 1-2 touchmove events)
}, false); };
p.box.removeEventListener('touchmove', handle_touchmove, false)
p.box.addEventListener('touchmove', handle_touchmove, false)
} }
p.padM.onmouseup = p.padM.onmouseup =
p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } }; p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } };
@ -992,4 +993,5 @@ var jscolor = {
}; };
jscolor.install(); jscolor.install();