src/pyams_skin/resources/js/ext/flot/jquery.flot.touchNavigate.min.js
changeset 557 bca7a7e058a3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_skin/resources/js/ext/flot/jquery.flot.touchNavigate.min.js	Thu Feb 13 11:43:31 2020 +0100
@@ -0,0 +1,1 @@
+!function(e){"use strict";function t(e,t){function i(t,n,i){A.touchedAxis=r(e,t,n,A),c(A)?A.navigationConstraint="unconstrained":A.navigationConstraint="axisConstrained"}var d,g,T,f={zoomEnable:!1,prevDistance:null,prevTapTime:0,prevPanPosition:{x:0,y:0},prevTapPosition:{x:0,y:0}},A={prevTouchedAxis:"none",currentTouchedAxis:"none",touchedAxis:null,navigationConstraint:"unconstrained",initialState:null},P=t.pan.interactive&&"manual"===t.pan.touchMode,m="smartLock"===t.pan.touchMode,y=t.pan.interactive&&(m||"smart"===t.pan.touchMode);d={start:function(t){if(i(t,"pan"),u(t,"pan",f,A),y){var n=v(t,"pan");A.initialState=e.navigationState(n.x,n.y)}},drag:function(t){if(i(t,"pan"),y){var n=v(t,"pan");e.smartPan({x:A.initialState.startPageX-n.x,y:A.initialState.startPageY-n.y},A.initialState,A.touchedAxis,!1,m)}else P&&(e.pan({left:-l(t,"pan",f).x,top:-l(t,"pan",f).y,axes:A.touchedAxis}),h(t,"pan",f,A))},end:function(t){i(t,"pan"),y&&e.smartPan.end(),o(t,f)&&updateprevPanPosition(t,"pan",f,A)}};var E;g={start:function(e){E&&(clearTimeout(E),E=null),i(e,"pinch"),s(e,f),u(e,"pinch",f,A)},drag:function(t){E||(E=setTimeout(function(){i(t,"pinch"),e.pan({left:-l(t,"pinch",f).x,top:-l(t,"pinch",f).y,axes:A.touchedAxis}),h(t,"pinch",f,A);var n=p(t);(f.zoomEnable||Math.abs(n-f.prevDistance)>x)&&(a(e,t,f,A),f.zoomEnable=!0),E=null},1e3/60))},end:function(e){E&&(clearTimeout(E),E=null),i(e,"pinch"),f.prevDistance=null}},T={recenterPlot:function(t){t&&t.detail&&"touchstart"===t.detail.type&&n(e,t,f,A)}},!0!==t.pan.enableTouch&&!0!==t.zoom.enableTouch||(e.hooks.bindEvents.push(function(e,t){var n=e.getOptions();n.zoom.interactive&&n.zoom.enableTouch&&(t[0].addEventListener("pinchstart",g.start,!1),t[0].addEventListener("pinchdrag",g.drag,!1),t[0].addEventListener("pinchend",g.end,!1)),n.pan.interactive&&n.pan.enableTouch&&(t[0].addEventListener("panstart",d.start,!1),t[0].addEventListener("pandrag",d.drag,!1),t[0].addEventListener("panend",d.end,!1)),n.recenter.interactive&&n.recenter.enableTouch&&t[0].addEventListener("doubletap",T.recenterPlot,!1)}),e.hooks.shutdown.push(function(e,t){t[0].removeEventListener("panstart",d.start),t[0].removeEventListener("pandrag",d.drag),t[0].removeEventListener("panend",d.end),t[0].removeEventListener("pinchstart",g.start),t[0].removeEventListener("pinchdrag",g.drag),t[0].removeEventListener("pinchend",g.end),t[0].removeEventListener("doubletap",T.recenterPlot)}))}function n(t,n,a,o){if(i(t,n,o),"x"===o.currentTouchedAxis&&"x"===o.prevTouchedAxis||"y"===o.currentTouchedAxis&&"y"===o.prevTouchedAxis||"none"===o.currentTouchedAxis&&"none"===o.prevTouchedAxis){var r;t.recenter({axes:o.touchedAxis}),r=o.touchedAxis?new e.Event("re-center",{detail:{axisTouched:o.touchedAxis}}):new e.Event("re-center",{detail:n}),t.getPlaceholder().trigger(r)}}function i(e,t,n){var i=e.getTouchedAxis(t.detail.firstTouch.x,t.detail.firstTouch.y);void 0!==i[0]&&(n.prevTouchedAxis=i[0].direction),void 0!==(i=e.getTouchedAxis(t.detail.secondTouch.x,t.detail.secondTouch.y))[0]&&(n.touchedAxis=i,n.currentTouchedAxis=i[0].direction),c(n)&&(n.touchedAxis=null,n.prevTouchedAxis="none",n.currentTouchedAxis="none")}function a(e,t,n,i){var a=e.offset(),o={left:0,top:0},r=p(t)/n.prevDistance,c=p(t);o.left=v(t,"pinch").x-a.left,o.top=v(t,"pinch").y-a.top,e.zoom({center:o,amount:r,axes:i.touchedAxis}),n.prevDistance=c}function o(e,t){return t.zoomEnable&&1===e.detail.touches.length}function r(e,t,n,i){if("pinchstart"!==t.type)return"panstart"===t.type?e.getTouchedAxis(t.detail.touches[0].pageX,t.detail.touches[0].pageY):"pinchend"===t.type?e.getTouchedAxis(t.detail.touches[0].pageX,t.detail.touches[0].pageY):i.touchedAxis;var a=e.getTouchedAxis(t.detail.touches[0].pageX,t.detail.touches[0].pageY),o=e.getTouchedAxis(t.detail.touches[1].pageX,t.detail.touches[1].pageY);return a.length===o.length&&a.toString()===o.toString()?a:void 0}function c(e){return!e.touchedAxis||0===e.touchedAxis.length}function s(e,t){t.prevDistance=p(e)}function u(e,t,n,i){var a,o=v(e,t);switch(i.navigationConstraint){case"unconstrained":i.touchedAxis=null,n.prevTapPosition={x:n.prevPanPosition.x,y:n.prevPanPosition.y},n.prevPanPosition={x:o.x,y:o.y};break;case"axisConstrained":a=i.touchedAxis[0].direction,i.currentTouchedAxis=a,n.prevTapPosition[a]=n.prevPanPosition[a],n.prevPanPosition[a]=o[a]}}function d(e,t,n,i){return Math.sqrt((e-n)*(e-n)+(t-i)*(t-i))}function p(e){var t=e.detail.touches[0],n=e.detail.touches[1];return d(t.pageX,t.pageY,n.pageX,n.pageY)}function h(e,t,n,i){var a=v(e,t);switch(i.navigationConstraint){case"unconstrained":n.prevPanPosition.x=a.x,n.prevPanPosition.y=a.y;break;case"axisConstrained":n.prevPanPosition[i.currentTouchedAxis]=a[i.currentTouchedAxis]}}function l(e,t,n){var i=v(e,t);return{x:i.x-n.prevPanPosition.x,y:i.y-n.prevPanPosition.y}}function v(e,t){return"pinch"===t?{x:(e.detail.touches[0].pageX+e.detail.touches[1].pageX)/2,y:(e.detail.touches[0].pageY+e.detail.touches[1].pageY)/2}:{x:e.detail.touches[0].pageX,y:e.detail.touches[0].pageY}}var x=e.plot.uiConstants.ZOOM_DISTANCE_MARGIN;e.plot.plugins.push({init:function(e){e.hooks.processOptions.push(t)},options:{zoom:{enableTouch:!1},pan:{enableTouch:!1,touchMode:"manual"},recenter:{enableTouch:!0}},name:"navigateTouch",version:"0.3"})}(jQuery);