/*
 Highstock JS v8.0.0 (2019-12-10)

 Drag-panes module

 (c) 2010-2019 Highsoft AS
 Author: Kacper Madej

 License: www.highcharts.com/license
*/
(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/drag-panes",["highcharts","highcharts/modules/stock"],function(f){a(f);a.Highcharts=f;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function f(a,d,x,f){a.hasOwnProperty(d)||(a[d]=f.apply(null,x))}a=a?a._modules:{};f(a,"modules/drag-panes.src.js",[a["parts/Globals.js"],a["parts/Utilities.js"]],function(a,d){var f=d.clamp,
y=d.isNumber,z=d.objectEach,u=d.relativeLength;d=d.wrap;var A=a.hasTouch,B=a.merge,e=a.addEvent,m=a.Axis,v=a.Pointer;B(!0,m.prototype.defaultYAxisOptions,{minLength:"10%",maxLength:"100%",resize:{controlledAxis:{next:[],prev:[]},enabled:!1,cursor:"ns-resize",lineColor:"#cccccc",lineDashStyle:"Solid",lineWidth:4,x:0,y:0}});a.AxisResizer=function(b){this.init(b)};a.AxisResizer.prototype={init:function(b,c){this.axis=b;this.options=b.options.resize;this.render();c||this.addMouseEvents()},render:function(){var b=
this.axis,c=b.chart,a=this.options,w=a.x,d=a.y,k=f(b.top+b.height+d,c.plotTop,c.plotTop+c.plotHeight),l={};c.styledMode||(l={cursor:a.cursor,stroke:a.lineColor,"stroke-width":a.lineWidth,dashstyle:a.lineDashStyle});this.lastPos=k-d;this.controlLine||(this.controlLine=c.renderer.path().addClass("highcharts-axis-resizer"));this.controlLine.add(b.axisGroup);a=c.styledMode?this.controlLine.strokeWidth():a.lineWidth;l.d=c.renderer.crispLine(["M",b.left+w,k,"L",b.left+b.width+w,k],a);this.controlLine.attr(l)},
addMouseEvents:function(){var b=this,a=b.controlLine.element,d=b.axis.chart.container,f=[],n,k,l;b.mouseMoveHandler=n=function(a){b.onMouseMove(a)};b.mouseUpHandler=k=function(a){b.onMouseUp(a)};b.mouseDownHandler=l=function(a){b.onMouseDown(a)};f.push(e(d,"mousemove",n),e(d.ownerDocument,"mouseup",k),e(a,"mousedown",l));A&&f.push(e(d,"touchmove",n),e(d.ownerDocument,"touchend",k),e(a,"touchstart",l));b.eventsToUnbind=f},onMouseMove:function(b){b.touches&&0===b.touches[0].pageX||!this.grabbed||(this.hasDragged=
!0,this.updateAxes(this.axis.chart.pointer.normalize(b).chartY-this.options.y))},onMouseUp:function(b){this.hasDragged&&this.updateAxes(this.axis.chart.pointer.normalize(b).chartY-this.options.y);this.grabbed=this.hasDragged=this.axis.chart.activeResizer=null},onMouseDown:function(b){this.axis.chart.pointer.reset(!1,0);this.grabbed=this.axis.chart.activeResizer=!0},updateAxes:function(b){var a=this,d=a.axis.chart,e=a.options.controlledAxis,n=0===e.next.length?[d.yAxis.indexOf(a.axis)+1]:e.next;e=
[a.axis].concat(e.prev);var k=[],l=!1,r=d.plotTop,p=d.plotHeight,m=r+p;b=f(b,r,m);var t=b-a.lastPos;1>t*t||([e,n].forEach(function(c,e){c.forEach(function(c,h){var g=(c=y(c)?d.yAxis[c]:e||h?d.get(c):c)&&c.options;if(g&&"navigator-y-axis"!==g.id){h=c.top;var n=Math.round(u(g.minLength,p));var q=Math.round(u(g.maxLength,p));e?(t=b-a.lastPos,g=Math.round(f(c.len-t,n,q)),h=c.top+t,h+g>m&&(q=m-g-h,b+=q,h+=q),h<r&&(h=r,h+g>m&&(g=p)),g===n&&(l=!0),k.push({axis:c,options:{top:100*(h-r)/p+"%",height:100*g/
p+"%"}})):(g=Math.round(f(b-h,n,q)),g===q&&(l=!0),b=h+g,k.push({axis:c,options:{height:100*g/p+"%"}}))}})}),l||(k.forEach(function(a){a.axis.update(a.options,!1)}),d.redraw(!1)))},destroy:function(){var a=this;delete a.axis.resizer;this.eventsToUnbind&&this.eventsToUnbind.forEach(function(a){a()});a.controlLine.destroy();z(a,function(b,d){a[d]=null})}};m.prototype.keepProps.push("resizer");e(m,"afterRender",function(){var b=this.resizer,c=this.options.resize;c&&(c=!1!==c.enabled,b?c?b.init(this,!0):
b.destroy():c&&(this.resizer=new a.AxisResizer(this)))});e(m,"destroy",function(a){!a.keepEvents&&this.resizer&&this.resizer.destroy()});d(v.prototype,"runPointActions",function(a){this.chart.activeResizer||a.apply(this,Array.prototype.slice.call(arguments,1))});d(v.prototype,"drag",function(a){this.chart.activeResizer||a.apply(this,Array.prototype.slice.call(arguments,1))})});f(a,"masters/modules/drag-panes.src.js",[],function(){})});
//# sourceMappingURL=drag-panes.js.map