[go: up one dir, main page]

Skip to content

Commit

Permalink
style(jscs fix): files jscs src --fix fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunkathuria authored and arschmitz committed Sep 30, 2016
1 parent 9e3d469 commit 67de3cb
Show file tree
Hide file tree
Showing 58 changed files with 1,704 additions and 1,704 deletions.
178 changes: 89 additions & 89 deletions src/hammer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { Manager } from './manager';
* @constructor
*/
function Hammer(element, options) {
options = options || {};
options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
return new Manager(element, options);
options = options || {};
options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
return new Manager(element, options);
}

/**
Expand All @@ -31,111 +31,111 @@ Hammer.VERSION = '{{PKG_VERSION}}';
* @namespace
*/
Hammer.defaults = {
/**
* set if DOM events are being triggered.
* But this is slower and unused by simple implementations, so disabled by default.
* @type {Boolean}
* @default false
*/
domEvents: false,
/**
* set if DOM events are being triggered.
* But this is slower and unused by simple implementations, so disabled by default.
* @type {Boolean}
* @default false
*/
domEvents: false,

/**
* The value for the touchAction property/fallback.
* When set to `compute` it will magically set the correct value based on the added recognizers.
* @type {String}
* @default compute
*/
touchAction: TOUCH_ACTION_COMPUTE,

/**
* @type {Boolean}
* @default true
*/
enable: true,

/**
* EXPERIMENTAL FEATURE -- can be removed/changed
* Change the parent input target element.
* If Null, then it is being set the to main element.
* @type {Null|EventTarget}
* @default null
*/
inputTarget: null,

/**
* force an input class
* @type {Null|Function}
* @default null
*/
inputClass: null,

/**
* Default recognizer setup when calling `Hammer()`
* When creating a new Manager these will be skipped.
* @type {Array}
*/
preset: [
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
[RotateRecognizer, { enable: false }],
[PinchRecognizer, { enable: false }, ['rotate']],
[SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],
[PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']],
[TapRecognizer],
[TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']],
[PressRecognizer]
],

/**
* Some CSS properties can be used to improve the working of Hammer.
* Add them to this method and they will be set when creating a new Manager.
* @namespace
*/
cssProps: {
/**
* The value for the touchAction property/fallback.
* When set to `compute` it will magically set the correct value based on the added recognizers.
* Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
* @type {String}
* @default compute
* @default 'none'
*/
touchAction: TOUCH_ACTION_COMPUTE,
userSelect: 'none',

/**
* @type {Boolean}
* @default true
* Disable the Windows Phone grippers when pressing an element.
* @type {String}
* @default 'none'
*/
enable: true,
touchSelect: 'none',

/**
* EXPERIMENTAL FEATURE -- can be removed/changed
* Change the parent input target element.
* If Null, then it is being set the to main element.
* @type {Null|EventTarget}
* @default null
* Disables the default callout shown when you touch and hold a touch target.
* On iOS, when you touch and hold a touch target such as a link, Safari displays
* a callout containing information about the link. This property allows you to disable that callout.
* @type {String}
* @default 'none'
*/
inputTarget: null,
touchCallout: 'none',

/**
* force an input class
* @type {Null|Function}
* @default null
* Specifies whether zooming is enabled. Used by IE10>
* @type {String}
* @default 'none'
*/
inputClass: null,
contentZooming: 'none',

/**
* Default recognizer setup when calling `Hammer()`
* When creating a new Manager these will be skipped.
* @type {Array}
* Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
preset: [
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
[RotateRecognizer, {enable: false}],
[PinchRecognizer, {enable: false}, ['rotate']],
[SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],
[PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],
[TapRecognizer],
[TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],
[PressRecognizer]
],
userDrag: 'none',

/**
* Some CSS properties can be used to improve the working of Hammer.
* Add them to this method and they will be set when creating a new Manager.
* @namespace
* Overrides the highlight color shown when the user taps a link or a JavaScript
* clickable element in iOS. This property obeys the alpha value, if specified.
* @type {String}
* @default 'rgba(0,0,0,0)'
*/
cssProps: {
/**
* Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
userSelect: 'none',

/**
* Disable the Windows Phone grippers when pressing an element.
* @type {String}
* @default 'none'
*/
touchSelect: 'none',

/**
* Disables the default callout shown when you touch and hold a touch target.
* On iOS, when you touch and hold a touch target such as a link, Safari displays
* a callout containing information about the link. This property allows you to disable that callout.
* @type {String}
* @default 'none'
*/
touchCallout: 'none',

/**
* Specifies whether zooming is enabled. Used by IE10>
* @type {String}
* @default 'none'
*/
contentZooming: 'none',

/**
* Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
userDrag: 'none',

/**
* Overrides the highlight color shown when the user taps a link or a JavaScript
* clickable element in iOS. This property obeys the alpha value, if specified.
* @type {String}
* @default 'rgba(0,0,0,0)'
*/
tapHighlightColor: 'rgba(0,0,0,0)'
}
tapHighlightColor: 'rgba(0,0,0,0)'
}
};

export { Hammer };
68 changes: 34 additions & 34 deletions src/input/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { Input } from '../inputjs/input-constructor';
import inherit from '../utils/inherit';

var MOUSE_INPUT_MAP = {
mousedown: INPUT_START,
mousemove: INPUT_MOVE,
mouseup: INPUT_END
mousedown: INPUT_START,
mousemove: INPUT_MOVE,
mouseup: INPUT_END
};

var MOUSE_ELEMENT_EVENTS = 'mousedown';
Expand All @@ -22,47 +22,47 @@ var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
* @extends Input
*/
function MouseInput() {
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;

this.pressed = false; // mousedown state
this.pressed = false; // mousedown state

Input.apply(this, arguments);
Input.apply(this, arguments);
}

inherit(MouseInput, Input, {
/**
* handle mouse events
* @param {Object} ev
*/
handler: function MEhandler(ev) {
var eventType = MOUSE_INPUT_MAP[ev.type];
/**
* handle mouse events
* @param {Object} ev
*/
handler: function MEhandler(ev) {
var eventType = MOUSE_INPUT_MAP[ev.type];

// on start we want to have the left mouse button down
if (eventType & INPUT_START && ev.button === 0) {
this.pressed = true;
}

if (eventType & INPUT_MOVE && ev.which !== 1) {
eventType = INPUT_END;
}
// on start we want to have the left mouse button down
if (eventType & INPUT_START && ev.button === 0) {
this.pressed = true;
}

// mouse must be down
if (!this.pressed) {
return;
}
if (eventType & INPUT_MOVE && ev.which !== 1) {
eventType = INPUT_END;
}

if (eventType & INPUT_END) {
this.pressed = false;
}
// mouse must be down
if (!this.pressed) {
return;
}

this.callback(this.manager, eventType, {
pointers: [ev],
changedPointers: [ev],
pointerType: INPUT_TYPE_MOUSE,
srcEvent: ev
});
if (eventType & INPUT_END) {
this.pressed = false;
}

this.callback(this.manager, eventType, {
pointers: [ev],
changedPointers: [ev],
pointerType: INPUT_TYPE_MOUSE,
srcEvent: ev
});
}
});

export { MouseInput };
Loading

0 comments on commit 67de3cb

Please sign in to comment.