Fix syncing bug LT-177, update Cornerstone package libraries
This commit is contained in:
1 parent
f7e24b8b10
commit
b624d12762
24 files changed
+1240
-708
No files matched your search
@@ -1,4 +1,4 @@
|
||||
/*! cornerstone - v0.8.4 - 2015-10-09 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstone */
|
||||
/*! cornerstone - v0.9.0 - 2016-02-04 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstone */
|
||||
if(typeof cornerstone === 'undefined'){
|
||||
cornerstone = {
|
||||
internal : {},
|
||||
@@ -482,8 +482,11 @@ if(typeof cornerstone === 'undefined'){
|
||||
|
||||
"use strict";
|
||||
|
||||
// dictionary of imageId to cachedImage objects
|
||||
var imageCache = {};
|
||||
|
||||
// dictionary of sharedCacheKeys to number of imageId's in cache with this shared cache key
|
||||
var sharedCacheKeys = {};
|
||||
// array of cachedImage objects
|
||||
var cachedImages = [];
|
||||
|
||||
var maximumSizeInBytes = 1024 * 1024 * 1024; // 1 GB
|
||||
@@ -549,6 +552,7 @@ if(typeof cornerstone === 'undefined'){
|
||||
var cachedImage = {
|
||||
loaded : false,
|
||||
imageId : imageId,
|
||||
sharedCacheKey: undefined, // the sharedCacheKey for this imageId. undefined by default
|
||||
imagePromise : imagePromise,
|
||||
timeStamp : new Date(),
|
||||
sizeInBytes: 0
|
||||
@@ -566,8 +570,23 @@ if(typeof cornerstone === 'undefined'){
|
||||
if (image.sizeInBytes.toFixed === undefined) {
|
||||
throw "putImagePromise: image.sizeInBytes is not a number";
|
||||
}
|
||||
cachedImage.sizeInBytes = image.sizeInBytes;
|
||||
cacheSizeInBytes += cachedImage.sizeInBytes;
|
||||
|
||||
// If this image has a shared cache key, reference count it and only
|
||||
// count the image size for the first one added with this sharedCacheKey
|
||||
if(image.sharedCacheKey) {
|
||||
cachedImage.sizeInBytes = image.sizeInBytes;
|
||||
cachedImage.sharedCacheKey = image.sharedCacheKey;
|
||||
if(sharedCacheKeys[image.sharedCacheKey]) {
|
||||
sharedCacheKeys[image.sharedCacheKey]++;
|
||||
} else {
|
||||
sharedCacheKeys[image.sharedCacheKey] = 1;
|
||||
cacheSizeInBytes += cachedImage.sizeInBytes;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cachedImage.sizeInBytes = image.sizeInBytes;
|
||||
cacheSizeInBytes += cachedImage.sizeInBytes;
|
||||
}
|
||||
purgeCacheIfNecessary();
|
||||
});
|
||||
}
|
||||
@@ -595,9 +614,23 @@ if(typeof cornerstone === 'undefined'){
|
||||
throw "removeImagePromise: imageId must not be undefined";
|
||||
}
|
||||
cachedImages.splice( cachedImages.indexOf(cachedImage), 1);
|
||||
cacheSizeInBytes -= cachedImage.sizeInBytes;
|
||||
|
||||
// If this is using a sharedCacheKey, decrement the cache size only
|
||||
// if it is the last imageId in the cache with this sharedCacheKey
|
||||
if(cachedImages.sharedCacheKey) {
|
||||
if(sharedCacheKeys[cachedImages.sharedCacheKey] === 1) {
|
||||
cacheSizeInBytes -= cachedImage.sizeInBytes;
|
||||
delete sharedCacheKeys[cachedImages.sharedCacheKey];
|
||||
} else {
|
||||
sharedCacheKeys[cachedImages.sharedCacheKey]--;
|
||||
}
|
||||
} else {
|
||||
cacheSizeInBytes -= cachedImage.sizeInBytes;
|
||||
}
|
||||
delete imageCache[imageId];
|
||||
|
||||
decache(cachedImage.imagePromise, cachedImage.imageId);
|
||||
|
||||
return cachedImage.imagePromise;
|
||||
}
|
||||
|
||||
@@ -609,15 +642,37 @@ if(typeof cornerstone === 'undefined'){
|
||||
};
|
||||
}
|
||||
|
||||
function decache(imagePromise, imageId) {
|
||||
imagePromise.then(function(image) {
|
||||
if(image.decache) {
|
||||
image.decache();
|
||||
}
|
||||
imagePromise.reject();
|
||||
delete imageCache[imageId];
|
||||
}).always(function() {
|
||||
delete imageCache[imageId];
|
||||
});
|
||||
}
|
||||
|
||||
function purgeCache() {
|
||||
while (cachedImages.length > 0) {
|
||||
var removedCachedImage = cachedImages.pop();
|
||||
delete imageCache[removedCachedImage.imageId];
|
||||
removedCachedImage.imagePromise.reject();
|
||||
var removedCachedImage = cachedImages.pop();
|
||||
decache(removedCachedImage.imagePromise, removedCachedImage.imageId);
|
||||
}
|
||||
cacheSizeInBytes = 0;
|
||||
}
|
||||
|
||||
function changeImageIdCacheSize(imageId, newCacheSize) {
|
||||
var cacheEntry = imageCache[imageId];
|
||||
if(cacheEntry) {
|
||||
cacheEntry.imagePromise.then(function(image) {
|
||||
var cacheSizeDifference = newCacheSize - image.sizeInBytes;
|
||||
image.sizeInBytes = newCacheSize;
|
||||
cacheSizeInBytes += cacheSizeDifference;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// module exports
|
||||
cornerstone.imageCache = {
|
||||
putImagePromise : putImagePromise,
|
||||
@@ -626,7 +681,8 @@ if(typeof cornerstone === 'undefined'){
|
||||
setMaximumSizeBytes: setMaximumSizeBytes,
|
||||
getCacheInfo : getCacheInfo,
|
||||
purgeCache: purgeCache,
|
||||
cachedImages: cachedImages
|
||||
cachedImages: cachedImages,
|
||||
changeImageIdCacheSize: changeImageIdCacheSize
|
||||
};
|
||||
|
||||
}(cornerstone));
|
||||
@@ -1522,38 +1578,39 @@ if(typeof cornerstone === 'undefined'){
|
||||
|
||||
function getRenderCanvas(enabledElement, image, invalidated)
|
||||
{
|
||||
// apply the lut to the stored pixel data onto the render canvas
|
||||
|
||||
if(enabledElement.viewport.voi.windowWidth === enabledElement.image.windowWidth &&
|
||||
enabledElement.viewport.voi.windowCenter === enabledElement.image.windowCenter &&
|
||||
enabledElement.viewport.invert === false)
|
||||
// The ww/wc is identity and not inverted - get a canvas with the image rendered into it for
|
||||
// fast drawing
|
||||
if(enabledElement.viewport.voi.windowWidth === 255 &&
|
||||
enabledElement.viewport.voi.windowCenter === 128 &&
|
||||
enabledElement.viewport.invert === false &&
|
||||
image.getCanvas &&
|
||||
image.getCanvas()
|
||||
)
|
||||
{
|
||||
// the color image voi/invert has not been modified, request the canvas that contains
|
||||
// it so we can draw it directly to the display canvas
|
||||
return image.getCanvas();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(doesImageNeedToBeRendered(enabledElement, image) === false && invalidated !== true) {
|
||||
return colorRenderCanvas;
|
||||
}
|
||||
|
||||
// If our render canvas does not match the size of this image reset it
|
||||
// NOTE: This might be inefficient if we are updating multiple images of different
|
||||
// sizes frequently.
|
||||
if(colorRenderCanvas.width !== image.width || colorRenderCanvas.height != image.height) {
|
||||
initializeColorRenderCanvas(image);
|
||||
}
|
||||
|
||||
// get the lut to use
|
||||
var colorLut = getLut(image, enabledElement.viewport);
|
||||
|
||||
// the color image voi/invert has been modified - apply the lut to the underlying
|
||||
// pixel data and put it into the renderCanvas
|
||||
cornerstone.storedColorPixelDataToCanvasImageData(image, colorLut, colorRenderCanvasData.data);
|
||||
colorRenderCanvasContext.putImageData(colorRenderCanvasData, 0, 0);
|
||||
// apply the lut to the stored pixel data onto the render canvas
|
||||
if(doesImageNeedToBeRendered(enabledElement, image) === false && invalidated !== true) {
|
||||
return colorRenderCanvas;
|
||||
}
|
||||
|
||||
// If our render canvas does not match the size of this image reset it
|
||||
// NOTE: This might be inefficient if we are updating multiple images of different
|
||||
// sizes frequently.
|
||||
if(colorRenderCanvas.width !== image.width || colorRenderCanvas.height != image.height) {
|
||||
initializeColorRenderCanvas(image);
|
||||
}
|
||||
|
||||
// get the lut to use
|
||||
var colorLut = getLut(image, enabledElement.viewport);
|
||||
|
||||
// the color image voi/invert has been modified - apply the lut to the underlying
|
||||
// pixel data and put it into the renderCanvas
|
||||
cornerstone.storedColorPixelDataToCanvasImageData(image, colorLut, colorRenderCanvasData.data);
|
||||
colorRenderCanvasContext.putImageData(colorRenderCanvasData, 0, 0);
|
||||
return colorRenderCanvas;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2148,7 +2205,7 @@ if(typeof cornerstone === 'undefined'){
|
||||
|
||||
function initShaders() {
|
||||
for (var id in cornerstone.webGL.shaders) {
|
||||
//console.log("WEBGL: Loading shader", id);
|
||||
console.log("WEBGL: Loading shader", id);
|
||||
var shader = cornerstone.webGL.shaders[ id ];
|
||||
shader.attributes = {};
|
||||
shader.uniforms = {};
|
||||
@@ -2168,13 +2225,13 @@ if(typeof cornerstone === 'undefined'){
|
||||
|
||||
function initRenderer() {
|
||||
if (cornerstone.webGL.isWebGLInitialized === true) {
|
||||
//console.log("WEBGL Renderer already initialized");
|
||||
console.log("WEBGL Renderer already initialized");
|
||||
return;
|
||||
}
|
||||
if ( initWebGL( renderCanvas ) ) {
|
||||
initBuffers();
|
||||
initShaders();
|
||||
//console.log("WEBGL Renderer initialized!");
|
||||
console.log("WEBGL Renderer initialized!");
|
||||
cornerstone.webGL.isWebGLInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*! cornerstoneMath - v0.1.2 - 2015-08-31 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneMath */
|
||||
/*! cornerstoneMath - v0.1.3 - 2016-02-04 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneMath */
|
||||
// Begin Source: src/vector3.js
|
||||
// Based on THREE.JS
|
||||
|
||||
@@ -1651,6 +1651,31 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the closest source point to a target point
|
||||
* given an array of source points.
|
||||
*
|
||||
* @param sources An Array of source Points
|
||||
* @param target The target Point
|
||||
* @returns Point The closest point from the points array
|
||||
*/
|
||||
function findClosestPoint(sources, target) {
|
||||
var distances = [];
|
||||
var minDistance;
|
||||
sources.forEach(function(source, index) {
|
||||
var distance = cornerstoneMath.point.distance(source, target);
|
||||
distances.push(distance);
|
||||
|
||||
if (index === 0) {
|
||||
minDistance = distance;
|
||||
} else {
|
||||
minDistance = Math.min(distance, minDistance);
|
||||
}
|
||||
});
|
||||
|
||||
var index = distances.indexOf(minDistance);
|
||||
return sources[index];
|
||||
}
|
||||
|
||||
// module exports
|
||||
cornerstoneMath.point =
|
||||
@@ -1660,7 +1685,8 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
||||
pageToPoint: pageToPoint,
|
||||
distance: distance,
|
||||
distanceSquared: distanceSquared,
|
||||
insideRect: insideRect
|
||||
insideRect: insideRect,
|
||||
findClosestPoint: findClosestPoint
|
||||
};
|
||||
|
||||
|
||||
@@ -1836,7 +1862,6 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
||||
|
||||
return (distance < maxDistance);
|
||||
}
|
||||
|
||||
function distanceToPoint(rect, point)
|
||||
{
|
||||
var minDistance = 655535;
|
||||
@@ -1850,7 +1875,7 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
||||
return minDistance;
|
||||
}
|
||||
|
||||
// Returns top-left and bottom-right of rectangle
|
||||
// Returns top-left and bottom-right points of the rectangle
|
||||
function rectToPoints (rect) {
|
||||
var rectPoints = {
|
||||
topLeft: {
|
||||
@@ -1959,11 +1984,12 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
||||
// module exports
|
||||
cornerstoneMath.rect =
|
||||
{
|
||||
rectToLineSegments : distanceToPoint,
|
||||
distanceToPoint : distanceToPoint,
|
||||
getIntersectionRect : getIntersectionRect
|
||||
|
||||
};
|
||||
|
||||
|
||||
return cornerstoneMath;
|
||||
}(cornerstoneMath));
|
||||
// End Source; src/rect.js
|
||||
}(cornerstoneMath));
|
||||
// End Source; src/rect.js
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,4 +1,4 @@
|
||||
/*! cornerstone-wado-image-loader - v0.9.0 - 2016-02-08 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneWADOImageLoader */
|
||||
/*! cornerstone-wado-image-loader - v0.9.1 - 2016-02-09 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneWADOImageLoader */
|
||||
//
|
||||
// This is a cornerstone image loader for WADO-URI requests. It has limited support for compressed
|
||||
// transfer syntaxes, check here to see what is currently supported:
|
||||
@@ -4294,7 +4294,7 @@ var JpegImage = (function jpegImage() {
|
||||
"use strict";
|
||||
|
||||
// module exports
|
||||
cornerstoneWADOImageLoader.version = '0.9.0';
|
||||
cornerstoneWADOImageLoader.version = '0.9.1';
|
||||
|
||||
}(cornerstoneWADOImageLoader));
|
||||
(function ($, cornerstone, cornerstoneWADOImageLoader) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*! Hammer.JS - v2.0.4 - 2015-09-25
|
||||
/*! Hammer.JS - v2.0.6 - 2015-12-23
|
||||
* http://hammerjs.github.io/
|
||||
*
|
||||
* Copyright (c) 2015 Jorik Tangelder;
|
||||
@@ -6,7 +6,7 @@
|
||||
(function(window, document, exportName, undefined) {
|
||||
'use strict';
|
||||
|
||||
var VENDOR_PREFIXES = ['', 'webkit', 'moz', 'MS', 'ms', 'o'];
|
||||
var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
|
||||
var TEST_ELEMENT = document.createElement('div');
|
||||
|
||||
var TYPE_FUNCTION = 'function';
|
||||
@@ -71,15 +71,69 @@ function each(obj, iterator, context) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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, '')
|
||||
.replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
|
||||
|
||||
var log = window.console && (window.console.warn || window.console.log);
|
||||
if (log) {
|
||||
log.call(window.console, deprecationMessage, stack);
|
||||
}
|
||||
return method.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* extend object.
|
||||
* means that properties in dest will be overwritten by the ones in src.
|
||||
* @param {Object} target
|
||||
* @param {...Object} objects_to_assign
|
||||
* @returns {Object} target
|
||||
*/
|
||||
var assign;
|
||||
if (typeof Object.assign !== 'function') {
|
||||
assign = function assign(target) {
|
||||
if (target === undefined || target === null) {
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
var output = Object(target);
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var source = arguments[index];
|
||||
if (source !== undefined && source !== null) {
|
||||
for (var nextKey in source) {
|
||||
if (source.hasOwnProperty(nextKey)) {
|
||||
output[nextKey] = source[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
} else {
|
||||
assign = Object.assign;
|
||||
}
|
||||
|
||||
/**
|
||||
* extend object.
|
||||
* means that properties in dest will be overwritten by the ones in src.
|
||||
* @param {Object} dest
|
||||
* @param {Object} src
|
||||
* @param {Boolean} [merge]
|
||||
* @param {Boolean=false} [merge]
|
||||
* @returns {Object} dest
|
||||
*/
|
||||
function extend(dest, src, merge) {
|
||||
var extend = deprecate(function extend(dest, src, merge) {
|
||||
var keys = Object.keys(src);
|
||||
var i = 0;
|
||||
while (i < keys.length) {
|
||||
@@ -89,7 +143,7 @@ function extend(dest, src, merge) {
|
||||
i++;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
}, 'extend', 'Use `assign`.');
|
||||
|
||||
/**
|
||||
* merge the values from src in the dest.
|
||||
@@ -98,9 +152,9 @@ function extend(dest, src, merge) {
|
||||
* @param {Object} src
|
||||
* @returns {Object} dest
|
||||
*/
|
||||
function merge(dest, src) {
|
||||
var merge = deprecate(function merge(dest, src) {
|
||||
return extend(dest, src, true);
|
||||
}
|
||||
}, 'merge', 'Use `assign`.');
|
||||
|
||||
/**
|
||||
* simple class inheritance
|
||||
@@ -117,7 +171,7 @@ function inherit(child, base, properties) {
|
||||
childP._super = baseP;
|
||||
|
||||
if (properties) {
|
||||
extend(childP, properties);
|
||||
assign(childP, properties);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,7 +852,7 @@ var POINTER_ELEMENT_EVENTS = 'pointerdown';
|
||||
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
|
||||
|
||||
// IE10 has prefixed support, and case-sensitive
|
||||
if (window.MSPointerEvent) {
|
||||
if (window.MSPointerEvent && !window.PointerEvent) {
|
||||
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
|
||||
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
|
||||
}
|
||||
@@ -1185,6 +1239,11 @@ TouchAction.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPanX && hasPanY) {
|
||||
// `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasNone ||
|
||||
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
|
||||
(hasPanX && direction & DIRECTION_VERTICAL)) {
|
||||
@@ -1216,9 +1275,12 @@ function cleanTouchActions(actions) {
|
||||
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
||||
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
||||
|
||||
// pan-x and pan-y can be combined
|
||||
// if both pan-x and pan-y are set (different recognizers
|
||||
// for different directions, e.g. horizontal pan but vertical swipe?)
|
||||
// we need none (as otherwise with pan-x pan-y combined none of these
|
||||
// recognizers will work, since the browser would handle all panning
|
||||
if (hasPanX && hasPanY) {
|
||||
return TOUCH_ACTION_PAN_X + ' ' + TOUCH_ACTION_PAN_Y;
|
||||
return TOUCH_ACTION_NONE;
|
||||
}
|
||||
|
||||
// pan-x OR pan-y
|
||||
@@ -1276,13 +1338,11 @@ var STATE_FAILED = 32;
|
||||
* @param {Object} options
|
||||
*/
|
||||
function Recognizer(options) {
|
||||
// make sure, options are copied over to a new object to prevent leaking it outside
|
||||
options = extend({}, options || {});
|
||||
this.options = assign({}, this.defaults, options || {});
|
||||
|
||||
this.id = uniqueId();
|
||||
|
||||
this.manager = null;
|
||||
this.options = merge(options, this.defaults);
|
||||
|
||||
// default is enable true
|
||||
this.options.enable = ifUndefined(this.options.enable, true);
|
||||
@@ -1306,7 +1366,7 @@ Recognizer.prototype = {
|
||||
* @return {Recognizer}
|
||||
*/
|
||||
set: function(options) {
|
||||
extend(this.options, options);
|
||||
assign(this.options, options);
|
||||
|
||||
// also update the touchAction, in case something changed about the directions/enabled state
|
||||
this.manager && this.manager.touchAction.update();
|
||||
@@ -1467,7 +1527,7 @@ Recognizer.prototype = {
|
||||
recognize: function(inputData) {
|
||||
// make a new copy of the inputData
|
||||
// so we can change the inputData without messing up the other recognizers
|
||||
var inputDataClone = extend({}, inputData);
|
||||
var inputDataClone = assign({}, inputData);
|
||||
|
||||
// is is enabled and allow recognizing?
|
||||
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
|
||||
@@ -1654,10 +1714,10 @@ inherit(PanRecognizer, AttrRecognizer, {
|
||||
var direction = this.options.direction;
|
||||
var actions = [];
|
||||
if (direction & DIRECTION_HORIZONTAL) {
|
||||
actions.push(TOUCH_ACTION_PAN_X);
|
||||
actions.push(TOUCH_ACTION_PAN_Y);
|
||||
}
|
||||
if (direction & DIRECTION_VERTICAL) {
|
||||
actions.push(TOUCH_ACTION_PAN_Y);
|
||||
actions.push(TOUCH_ACTION_PAN_X);
|
||||
}
|
||||
return actions;
|
||||
},
|
||||
@@ -1765,8 +1825,8 @@ inherit(PressRecognizer, Recognizer, {
|
||||
defaults: {
|
||||
event: 'press',
|
||||
pointers: 1,
|
||||
time: 500, // minimal time of the pointer to be pressed
|
||||
threshold: 5 // a minimal movement is ok, but keep it low
|
||||
time: 251, // minimal time of the pointer to be pressed
|
||||
threshold: 9 // a minimal movement is ok, but keep it low
|
||||
},
|
||||
|
||||
getTouchAction: function() {
|
||||
@@ -1864,7 +1924,7 @@ inherit(SwipeRecognizer, AttrRecognizer, {
|
||||
defaults: {
|
||||
event: 'swipe',
|
||||
threshold: 10,
|
||||
velocity: 0.65,
|
||||
velocity: 0.3,
|
||||
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
||||
pointers: 1
|
||||
},
|
||||
@@ -1936,7 +1996,7 @@ inherit(TapRecognizer, Recognizer, {
|
||||
taps: 1,
|
||||
interval: 300, // max time between the multi-tap taps
|
||||
time: 250, // max time of the pointer to be down (like finger on the screen)
|
||||
threshold: 2, // a minimal movement is ok, but keep it low
|
||||
threshold: 9, // a minimal movement is ok, but keep it low
|
||||
posThreshold: 10 // a multi-tap can be a bit off the initial position
|
||||
},
|
||||
|
||||
@@ -2018,7 +2078,7 @@ inherit(TapRecognizer, Recognizer, {
|
||||
});
|
||||
|
||||
/**
|
||||
* Simple way to create an manager with a default set of recognizers.
|
||||
* Simple way to create a manager with a default set of recognizers.
|
||||
* @param {HTMLElement} element
|
||||
* @param {Object} [options]
|
||||
* @constructor
|
||||
@@ -2032,7 +2092,7 @@ function Hammer(element, options) {
|
||||
/**
|
||||
* @const {string}
|
||||
*/
|
||||
Hammer.VERSION = '2.0.4';
|
||||
Hammer.VERSION = '2.0.6';
|
||||
|
||||
/**
|
||||
* default settings
|
||||
@@ -2156,9 +2216,8 @@ var FORCED_STOP = 2;
|
||||
* @constructor
|
||||
*/
|
||||
function Manager(element, options) {
|
||||
options = options || {};
|
||||
this.options = assign({}, Hammer.defaults, options || {});
|
||||
|
||||
this.options = merge(options, Hammer.defaults);
|
||||
this.options.inputTarget = this.options.inputTarget || element;
|
||||
|
||||
this.handlers = {};
|
||||
@@ -2171,7 +2230,7 @@ function Manager(element, options) {
|
||||
|
||||
toggleCssProps(this, true);
|
||||
|
||||
each(options.recognizers, function(item) {
|
||||
each(this.options.recognizers, function(item) {
|
||||
var recognizer = this.add(new (item[0])(item[1]));
|
||||
item[2] && recognizer.recognizeWith(item[2]);
|
||||
item[3] && recognizer.requireFailure(item[3]);
|
||||
@@ -2185,7 +2244,7 @@ Manager.prototype = {
|
||||
* @returns {Manager}
|
||||
*/
|
||||
set: function(options) {
|
||||
extend(this.options, options);
|
||||
assign(this.options, options);
|
||||
|
||||
// Options that need a little more setup
|
||||
if (options.touchAction) {
|
||||
@@ -2319,11 +2378,19 @@ Manager.prototype = {
|
||||
return this;
|
||||
}
|
||||
|
||||
var recognizers = this.recognizers;
|
||||
recognizer = this.get(recognizer);
|
||||
recognizers.splice(inArray(recognizers, recognizer), 1);
|
||||
|
||||
this.touchAction.update();
|
||||
// let's make sure this recognizer exists
|
||||
if (recognizer) {
|
||||
var recognizers = this.recognizers;
|
||||
var index = inArray(recognizers, recognizer);
|
||||
|
||||
if (index !== -1) {
|
||||
recognizers.splice(index, 1);
|
||||
this.touchAction.update();
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
@@ -2354,7 +2421,7 @@ Manager.prototype = {
|
||||
if (!handler) {
|
||||
delete handlers[event];
|
||||
} else {
|
||||
handlers[event].splice(inArray(handlers[event], handler), 1);
|
||||
handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
@@ -2430,7 +2497,7 @@ function triggerDomEvent(event, data) {
|
||||
data.target.dispatchEvent(gestureEvent);
|
||||
}
|
||||
|
||||
extend(Hammer, {
|
||||
assign(Hammer, {
|
||||
INPUT_START: INPUT_START,
|
||||
INPUT_MOVE: INPUT_MOVE,
|
||||
INPUT_END: INPUT_END,
|
||||
@@ -2477,12 +2544,18 @@ extend(Hammer, {
|
||||
each: each,
|
||||
merge: merge,
|
||||
extend: extend,
|
||||
assign: assign,
|
||||
inherit: inherit,
|
||||
bindFn: bindFn,
|
||||
prefixed: prefixed
|
||||
});
|
||||
|
||||
if (typeof define == TYPE_FUNCTION && define.amd) {
|
||||
// this prevents errors when Hammer is loaded in the presence of an AMD
|
||||
// style loader but by script tag, not by the loader.
|
||||
var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line
|
||||
freeGlobal.Hammer = Hammer;
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function() {
|
||||
return Hammer;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user