code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function handleTouchMoveRotate(event) {
//console.log( 'handleTouchMoveRotate' );
rotateEnd.set(event.pointers[0].pageX, event.pointers[0].pageY);
rotateDelta.subVectors(rotateEnd, rotateStart);
var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
// rotating ac... | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | handleTouchMoveRotate | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function handleTouchMoveDolly(event) {
//console.log( 'handleTouchMoveDolly' );
var dx = event.pointers[0].pageX - event.pointers[1].pageX;
var dy = event.pointers[0].pageY - event.pointers[1].pageY;
var distance = Math.sqrt(dx * dx + dy * dy);
dollyEnd.set(0, distance);
dollyDelta.subVector... | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | handleTouchMoveDolly | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function handleTouchMovePan(event) {
//console.log( 'handleTouchMovePan' );
panEnd.set(event.deltaX, event.deltaY);
panDelta.subVectors(panEnd, panStart);
pan(panDelta.x, panDelta.y);
panStart.copy(panEnd);
scope.update();
} | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | handleTouchMovePan | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function onMouseDown(event) {
if (scope.enabled === false) return;
event.preventDefault();
if (event.button === scope.mouseButtons.ORBIT) {
if (scope.enableRotate === false) return;
handleMouseDownRotate(event);
state = STATE.ROTATE;
} else if (event.button === scope.mouseButtons.ZOO... | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | onMouseDown | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function onMouseMove(event) {
if (scope.enabled === false) return;
event.preventDefault();
if (state === STATE.ROTATE) {
if (scope.enableRotate === false) return;
handleMouseMoveRotate(event);
} else if (state === STATE.DOLLY) {
if (scope.enableZoom === false) return;
handleMou... | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | onMouseMove | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function onMouseUp(event) {
if (scope.enabled === false) return;
handleMouseUp(event);
document.removeEventListener('mousemove', onMouseMove, false);
document.removeEventListener('mouseup', onMouseUp, false);
document.removeEventListener('mouseout', onMouseUp, false);
scope.dispatchEvent(endEv... | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | onMouseUp | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function onMouseWheel(event) {
if (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;
event.preventDefault();
event.stopPropagation();
handleMouseWheel(event);
scope.dispatchEvent(startEvent); // not sure why these are here...
scope.dispatchEvent(endEvent);
... | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | onMouseWheel | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function onKeyDown(event) {
if (scope.enabled === false || scope.enableKeys === false || scope.enablePan === false) return;
handleKeyDown(event);
} | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | onKeyDown | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function onTouchStart(event) {
if (scope.enabled === false) return;
switch (event.touches.length) {
case 1:
// one-fingered touch: rotate
if (scope.enableRotate === false) return;
handleTouchStartRotate(event);
state = STATE.TOUCH_ROTATE;
break;
case 2:
// two... | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | onTouchStart | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function onTouchMove(event) {
if (scope.enabled === false) return;
event.preventDefault();
event.stopPropagation();
switch (event.touches.length) {
case 1:
// one-fingered touch: rotate
if (scope.enableRotate === false) return;
if (state !== STATE.TOUCH_ROTATE) return; // is thi... | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | onTouchMove | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function onTouchEnd(event) {
if (scope.enabled === false) return;
handleTouchEnd(event);
scope.dispatchEvent(endEvent);
state = STATE.NONE;
} | @author qiao / https://github.com/qiao
@author mrdoob / http://mrdoob.com
@author alteredq / http://alteredqualia.com/
@author WestLangley / http://github.com/WestLangley
@author erich666 / http://erichaines.com | onTouchEnd | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function setTimeoutContext(fn, timeout, context) {
return setTimeout(bindFn(fn, context), timeout);
} | set a timeout with a given scope
@param {Function} fn
@param {Number} timeout
@param {Object} context
@returns {number} | setTimeoutContext | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function invokeArrayArg(arg, fn, context) {
if (Array.isArray(arg)) {
each(arg, context[fn], context);
return true;
}
return false;
} | if the argument is an array, we want to execute the fn on each entry
if it aint an array we don't want to do a thing.
this is used by all the methods that accept a single and array argument.
@param {*|Array} arg
@param {String} fn
@param {Object} [context]
@returns {Boolean} | invokeArrayArg | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function each(obj, iterator, context) {
var i;
if (!obj) {
return;
}
if (obj.forEach) {
obj.forEach(iterator, context);
} else if (obj.length !== undefined) {
i = 0;
while (i < obj.length) {
iterator.call(context, obj[i], i, obj);
... | walk objects and arrays
@param {Object} obj
@param {Function} iterator
@param {Object} context | each | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function deprecate(method, name, message) {
var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
return function() {
var e = new Error('get-stack-trace');
var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
.replace(/^\s+at\s+/gm, '')
... | wrap a method with a deprecation warning and stack trace
@param {Function} method
@param {String} name
@param {String} message
@returns {Function} A new function wrapping the supplied method. | deprecate | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function inherit(child, base, properties) {
var baseP = base.prototype,
childP;
childP = child.prototype = Object.create(baseP);
childP.constructor = child;
childP._super = baseP;
if (properties) {
assign(childP, properties);
}
} | simple class inheritance
@param {Function} child
@param {Function} base
@param {Object} [properties] | inherit | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function bindFn(fn, context) {
return function boundFn() {
return fn.apply(context, arguments);
};
} | simple function bind
@param {Function} fn
@param {Object} context
@returns {Function} | bindFn | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function boolOrFn(val, args) {
if (typeof val == TYPE_FUNCTION) {
return val.apply(args ? args[0] || undefined : undefined, args);
}
return val;
} | let a boolean value also be a function that must return a boolean
this first item in args will be used as the context
@param {Boolean|Function} val
@param {Array} [args]
@returns {Boolean} | boolOrFn | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function ifUndefined(val1, val2) {
return (val1 === undefined) ? val2 : val1;
} | use the val2 when val1 is undefined
@param {*} val1
@param {*} val2
@returns {*} | ifUndefined | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function addEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.addEventListener(type, handler, false);
});
} | addEventListener with multiple events at once
@param {EventTarget} target
@param {String} types
@param {Function} handler | addEventListeners | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function removeEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.removeEventListener(type, handler, false);
});
} | removeEventListener with multiple events at once
@param {EventTarget} target
@param {String} types
@param {Function} handler | removeEventListeners | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function hasParent(node, parent) {
while (node) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
} | find if a node is in the given parent
@method hasParent
@param {HTMLElement} node
@param {HTMLElement} parent
@return {Boolean} found | hasParent | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function inStr(str, find) {
return str.indexOf(find) > -1;
} | small indexOf wrapper
@param {String} str
@param {String} find
@returns {Boolean} found | inStr | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function splitStr(str) {
return str.trim().split(/\s+/g);
} | split string on whitespace
@param {String} str
@returns {Array} words | splitStr | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function inArray(src, find, findByKey) {
if (src.indexOf && !findByKey) {
return src.indexOf(find);
} else {
var i = 0;
while (i < src.length) {
if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
return i;
}
... | find if a array contains the object using indexOf or a simple polyFill
@param {Array} src
@param {String} find
@param {String} [findByKey]
@return {Boolean|Number} false when not found, or the index | inArray | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function toArray(obj) {
return Array.prototype.slice.call(obj, 0);
} | convert array-like objects to real arrays
@param {Object} obj
@returns {Array} | toArray | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function uniqueArray(src, key, sort) {
var results = [];
var values = [];
var i = 0;
while (i < src.length) {
var val = key ? src[i][key] : src[i];
if (inArray(values, val) < 0) {
results.push(src[i]);
}
values[i] = val;
i++;
}
... | unique array with objects based on a key (like 'id') or just by the array's value
@param {Array} src [{id:1},{id:2},{id:1}]
@param {String} [key]
@param {Boolean} [sort=False]
@returns {Array} [{id:1},{id:2}] | uniqueArray | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function prefixed(obj, property) {
var prefix, prop;
var camelProp = property[0].toUpperCase() + property.slice(1);
var i = 0;
while (i < VENDOR_PREFIXES.length) {
prefix = VENDOR_PREFIXES[i];
prop = (prefix) ? prefix + camelProp : property;
if (prop in obj) {
... | get the prefixed property
@param {Object} obj
@param {String} property
@returns {String|Undefined} prefixed | prefixed | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function uniqueId() {
return _uniqueId++;
} | get a unique id
@returns {number} uniqueId | uniqueId | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getWindowForElement(element) {
var doc = element.ownerDocument || element;
return (doc.defaultView || doc.parentWindow || window);
} | get the window object of an element
@param {HTMLElement} element
@returns {DocumentView|Window} | getWindowForElement | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function Input(manager, callback) {
var self = this;
this.manager = manager;
this.callback = callback;
this.element = manager.element;
this.target = manager.options.inputTarget;
// smaller wrapper around the handler, for the scope and the enabled state of the manager,
// so when dis... | create new input type manager
@param {Manager} manager
@param {Function} callback
@returns {Input}
@constructor | Input | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function createInputInstance(manager) {
var Type;
var inputClass = manager.options.inputClass;
if (inputClass) {
Type = inputClass;
} else if (SUPPORT_POINTER_EVENTS) {
Type = PointerEventInput;
} else if (SUPPORT_ONLY_TOUCH) {
Type = TouchInput;
} else if (!SU... | create new input type manager
called by the Manager constructor
@param {Hammer} manager
@returns {Input} | createInputInstance | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function inputHandler(manager, eventType, input) {
var pointersLen = input.pointers.length;
var changedPointersLen = input.changedPointers.length;
var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLe... | handle input events
@param {Manager} manager
@param {String} eventType
@param {Object} input | inputHandler | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function computeInputData(manager, input) {
var session = manager.session;
var pointers = input.pointers;
var pointersLength = pointers.length;
// store the first input to calculate the distance and direction
if (!session.firstInput) {
session.firstInput = simpleCloneInputData(input)... | extend the data with some usable properties like scale, rotate, velocity etc
@param {Object} manager
@param {Object} input | computeInputData | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function computeDeltaXY(session, input) {
var center = input.center;
var offset = session.offsetDelta || {};
var prevDelta = session.prevDelta || {};
var prevInput = session.prevInput || {};
if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
prevDelta = sessi... | extend the data with some usable properties like scale, rotate, velocity etc
@param {Object} manager
@param {Object} input | computeDeltaXY | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function computeIntervalInputData(session, input) {
var last = session.lastInterval || input,
deltaTime = input.timeStamp - last.timeStamp,
velocity, velocityX, velocityY, direction;
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
... | velocity is calculated every x ms
@param {Object} session
@param {Object} input | computeIntervalInputData | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function simpleCloneInputData(input) {
// make a simple copy of the pointers because we will get a reference if we don't
// we only need clientXY for the calculations
var pointers = [];
var i = 0;
while (i < input.pointers.length) {
pointers[i] = {
clientX: round(input.poi... | create a simple clone from the input used for storage of firstInput and firstMultiple
@param {Object} input
@returns {Object} clonedInputData | simpleCloneInputData | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getCenter(pointers) {
var pointersLength = pointers.length;
// no need to loop when only one touch
if (pointersLength === 1) {
return {
x: round(pointers[0].clientX),
y: round(pointers[0].clientY)
};
}
var x = 0, y = 0, i = 0;
while ... | get the center of all the pointers
@param {Array} pointers
@return {Object} center contains `x` and `y` properties | getCenter | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getVelocity(deltaTime, x, y) {
return {
x: x / deltaTime || 0,
y: y / deltaTime || 0
};
} | calculate the velocity between two points. unit is in px per ms.
@param {Number} deltaTime
@param {Number} x
@param {Number} y
@return {Object} velocity `x` and `y` | getVelocity | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getDirection(x, y) {
if (x === y) {
return DIRECTION_NONE;
}
if (abs(x) >= abs(y)) {
return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
} | get the direction between two points
@param {Number} x
@param {Number} y
@return {Number} direction | getDirection | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getDistance(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
return Math.sqrt((x * x) + (y * y));
} | calculate the absolute distance between two points
@param {Object} p1 {x, y}
@param {Object} p2 {x, y}
@param {Array} [props] containing x and y keys
@return {Number} distance | getDistance | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getAngle(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
return Math.atan2(y, x) * 180 / Math.PI;
} | calculate the angle between two coordinates
@param {Object} p1
@param {Object} p2
@param {Array} [props] containing x and y keys
@return {Number} angle | getAngle | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getRotation(start, end) {
return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
} | calculate the rotation degrees between two pointersets
@param {Array} start array of pointers
@param {Array} end array of pointers
@return {Number} rotation | getRotation | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getScale(start, end) {
return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
} | calculate the scale factor between two pointersets
no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
@param {Array} start array of pointers
@param {Array} end array of pointers
@return {Number} scale | getScale | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function MouseInput() {
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;
this.pressed = false; // mousedown state
Input.apply(this, arguments);
} | Mouse events input
@constructor
@extends Input | MouseInput | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function PointerEventInput() {
this.evEl = POINTER_ELEMENT_EVENTS;
this.evWin = POINTER_WINDOW_EVENTS;
Input.apply(this, arguments);
this.store = (this.manager.session.pointerEvents = []);
} | Pointer events input
@constructor
@extends Input | PointerEventInput | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function SingleTouchInput() {
this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
this.started = false;
Input.apply(this, arguments);
} | Touch events input
@constructor
@extends Input | SingleTouchInput | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function normalizeSingleTouches(ev, type) {
var all = toArray(ev.touches);
var changed = toArray(ev.changedTouches);
if (type & (INPUT_END | INPUT_CANCEL)) {
all = uniqueArray(all.concat(changed), 'identifier', true);
}
return [all, changed];
} | @this {TouchInput}
@param {Object} ev
@param {Number} type flag
@returns {undefined|Array} [all, changed] | normalizeSingleTouches | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function TouchInput() {
this.evTarget = TOUCH_TARGET_EVENTS;
this.targetIds = {};
Input.apply(this, arguments);
} | Multi-user touch events input
@constructor
@extends Input | TouchInput | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getTouches(ev, type) {
var allTouches = toArray(ev.touches);
var targetIds = this.targetIds;
// when there is only one touch, the process can be simplified
if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
targetIds[allTouches[0].identifier] = true;
ret... | @this {TouchInput}
@param {Object} ev
@param {Number} type flag
@returns {undefined|Array} [all, changed] | getTouches | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function TouchAction(manager, value) {
this.manager = manager;
this.set(value);
} | Touch Action
sets the touchAction property or uses the js alternative
@param {Manager} manager
@param {String} value
@constructor | TouchAction | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function cleanTouchActions(actions) {
// none
if (inStr(actions, TOUCH_ACTION_NONE)) {
return TOUCH_ACTION_NONE;
}
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
// if both pan-x and pan-y are set (different recognizers
... | when the touchActions are collected they are not a valid value, so we need to clean things up. *
@param {String} actions
@returns {*} | cleanTouchActions | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getTouchActionProps() {
if (!NATIVE_TOUCH_ACTION) {
return false;
}
var touchMap = {};
var cssSupports = window.CSS && window.CSS.supports;
['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {
// If css.supports is not supported ... | when the touchActions are collected they are not a valid value, so we need to clean things up. *
@param {String} actions
@returns {*} | getTouchActionProps | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function Recognizer(options) {
this.options = assign({}, this.defaults, options || {});
this.id = uniqueId();
this.manager = null;
// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
this.state = STATE_POSSIBLE;
this.simultaneous = {};
... | Recognizer
Every recognizer needs to extend from this class.
@constructor
@param {Object} options | Recognizer | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function stateStr(state) {
if (state & STATE_CANCELLED) {
return 'cancel';
} else if (state & STATE_ENDED) {
return 'end';
} else if (state & STATE_CHANGED) {
return 'move';
} else if (state & STATE_BEGAN) {
return 'start';
}
return '';
} | get a usable string, used as event postfix
@param {Const} state
@returns {String} state | stateStr | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function directionStr(direction) {
if (direction == DIRECTION_DOWN) {
return 'down';
} else if (direction == DIRECTION_UP) {
return 'up';
} else if (direction == DIRECTION_LEFT) {
return 'left';
} else if (direction == DIRECTION_RIGHT) {
return 'right';
}
... | direction cons to string
@param {Const} direction
@returns {String} | directionStr | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
var manager = recognizer.manager;
if (manager) {
return manager.get(otherRecognizer);
}
return otherRecognizer;
} | get a recognizer by name if it is bound to a manager
@param {Recognizer|String} otherRecognizer
@param {Recognizer} recognizer
@returns {Recognizer} | getRecognizerByNameIfManager | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function AttrRecognizer() {
Recognizer.apply(this, arguments);
} | This recognizer is just used as a base for the simple attribute recognizers.
@constructor
@extends Recognizer | AttrRecognizer | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function PanRecognizer() {
AttrRecognizer.apply(this, arguments);
this.pX = null;
this.pY = null;
} | Pan
Recognized when the pointer is down and moved in the allowed direction.
@constructor
@extends AttrRecognizer | PanRecognizer | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function PinchRecognizer() {
AttrRecognizer.apply(this, arguments);
} | Pinch
Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
@constructor
@extends AttrRecognizer | PinchRecognizer | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function PressRecognizer() {
Recognizer.apply(this, arguments);
this._timer = null;
this._input = null;
} | Press
Recognized when the pointer is down for x ms without any movement.
@constructor
@extends Recognizer | PressRecognizer | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function RotateRecognizer() {
AttrRecognizer.apply(this, arguments);
} | Rotate
Recognized when two or more pointer are moving in a circular motion.
@constructor
@extends AttrRecognizer | RotateRecognizer | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function SwipeRecognizer() {
AttrRecognizer.apply(this, arguments);
} | Swipe
Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
@constructor
@extends AttrRecognizer | SwipeRecognizer | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function Hammer(element, options) {
options = options || {};
options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
return new Manager(element, options);
} | Simple way to create a manager with a default set of recognizers.
@param {HTMLElement} element
@param {Object} [options]
@constructor | Hammer | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function Manager(element, options) {
this.options = assign({}, Hammer.defaults, options || {});
this.options.inputTarget = this.options.inputTarget || element;
this.handlers = {};
this.session = {};
this.recognizers = [];
this.oldCssProps = {};
this.element = element;
this.... | Manager
@param {HTMLElement} element
@param {Object} [options]
@constructor | Manager | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function toggleCssProps(manager, add) {
var element = manager.element;
if (!element.style) {
return;
}
var prop;
each(manager.options.cssProps, function(value, name) {
prop = prefixed(element.style, name);
if (add) {
manager.oldCssProps[prop] = element.st... | add/remove the css properties as defined in manager.options.cssProps
@param {Manager} manager
@param {Boolean} add | toggleCssProps | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function triggerDomEvent(event, data) {
var gestureEvent = document.createEvent('Event');
gestureEvent.initEvent(event, true, true);
gestureEvent.gesture = data;
data.target.dispatchEvent(gestureEvent);
} | trigger dom event
@param {String} event
@param {Object} data | triggerDomEvent | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
... | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | inspect | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | stylizeWithColor | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function stylizeNoColor(str, styleType) {
return str;
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | stylizeNoColor | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | arrayToHash | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is sp... | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | formatValue | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
... | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | formatPrimitive | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | formatError | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
output.push(... | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | formatArray | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Ge... | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | formatProperty | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function reduceToSingleString(output, base, braces) {
var numLinesEst = 0;
var length = output.reduce(function(prev, cur) {
numLinesEst++;
if (cur.indexOf('\n') >= 0) numLinesEst++;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] ... | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | reduceToSingleString | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isArray(ar) {
return Array.isArray(ar);
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isArray | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isBoolean(arg) {
return typeof arg === 'boolean';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isBoolean | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isNull(arg) {
return arg === null;
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isNull | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isNullOrUndefined(arg) {
return arg == null;
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isNullOrUndefined | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isNumber(arg) {
return typeof arg === 'number';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isNumber | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isString(arg) {
return typeof arg === 'string';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isString | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isSymbol(arg) {
return typeof arg === 'symbol';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isSymbol | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isUndefined(arg) {
return arg === void 0;
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isUndefined | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isRegExp | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isObject | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isDate | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isError(e) {
return isObject(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isError | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isFunction(arg) {
return typeof arg === 'function';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isFunction | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | isPrimitive | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function objectToString(o) {
return Object.prototype.toString.call(o);
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | objectToString | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | pad | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Object} opts Optional options object that alters the output. | timestamp | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
} | Inherit the prototype methods from one constructor into another.
The Function.prototype.inherits from lang.js rewritten as a standalone
function (not on Function.prototype). NOTE: If this file is to be loaded
during bootstrapping this function needs to be rewritten using some native
functions as prototype setup using ... | hasOwnProperty | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function reqwest(o, fn) {
return new Reqwest(o, fn)
} | `fail` will execute when the request fails | reqwest | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function normalize(s) {
return s ? s.replace(/\r?\n/g, '\r\n') : ''
} | `fail` will execute when the request fails | normalize | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function serial(el, cb) {
var n = el.name
, t = el.tagName.toLowerCase()
, optCb = function (o) {
// IE gives value="" even where there is no value attribute
// 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273
if (o && !o['disabled'])
... | `fail` will execute when the request fails | serial | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
optCb = function (o) {
// IE gives value="" even where there is no value attribute
// 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273
if (o && !o['disabled'])
cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o... | `fail` will execute when the request fails | optCb | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
function eachFormElement() {
var cb = this
, e, i
, serializeSubtags = function (e, tags) {
var i, j, fa
for (i = 0; i < tags.length; i++) {
fa = e[byTag](tags[i])
for (j = 0; j < fa.length; j++) serial(fa[j], cb)
}
}
for (i =... | `fail` will execute when the request fails | eachFormElement | javascript | UDST/vizicities | dist/vizicities.js | https://github.com/UDST/vizicities/blob/master/dist/vizicities.js | BSD-3-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.