From f166ddc01ccc9d75fc81a7c132ce7ca03ef0d905 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 4 Dec 2013 23:44:32 +0100 Subject: [PATCH] update mouse events example --- examples/ui/mouse_events/js/example.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/ui/mouse_events/js/example.js b/examples/ui/mouse_events/js/example.js index 928f609b..cce6faea 100644 --- a/examples/ui/mouse_events/js/example.js +++ b/examples/ui/mouse_events/js/example.js @@ -7,7 +7,7 @@ Ox.load('UI', function() { var $target = Ox.Element() .addClass('OxMonospace') .attr({id: 'target'}) - .html('click/hold/drag') + .html('click/hold/drag/scroll/swipe') .appendTo(Ox.$body), $log = Ox.Element() .attr({id: 'log'}) @@ -22,7 +22,8 @@ Ox.load('UI', function() { .appendTo(Ox.$body); [ 'anyclick', 'singleclick', 'doubleclick', 'mousedown', 'mouserepeat', - 'dragstart', 'drag', 'dragenter', 'dragleave', 'dragpause', 'dragend' + 'dragstart', 'drag', 'dragenter', 'dragleave', 'dragpause', 'dragend', + 'mousewheel' ].forEach(function(event) { $target.bindEvent(event, function(e) { var date = new Date(); @@ -33,12 +34,16 @@ Ox.load('UI', function() { + '.' + (Ox.pad(date % 1000, 3)) + ' ' + event + ' ' + JSON.stringify( - Ox.extend(e.clientX ? { + Ox.extend('clientX' in e ? { clientX: e.clientX, clientY: e.clientY, - } : {}, e.clientDX ? { + } : {}, 'clientDX' in e ? { clientDX: e.clientDX, clientDY: e.clientDY + } : {}, 'deltaX' in e ? { + deltaX: e.deltaX, + deltaY: e.deltaY, + deltaFactor: e.deltaFactor } : {}) ) .replace(/"/g, '')