highcharts
Version:
JavaScript charting framework
13 lines • 4.17 kB
JavaScript
let e;/**
* Highcharts JS v12.6.0 (2026-04-13)
* @module highcharts/modules/mouse-wheel-zoom
* @requires highcharts
*
* Mousewheel zoom module
*
* (c) 2023-2026 Highsoft AS
* Author: Askel Eirik Johansson
*
* A commercial license may be required depending on use.
* See www.highcharts.com/license
*/import*as t from"../highcharts.js";var o={};o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let r=t.default;var n=o.n(r);let{doc:i,win:l}=n();function s(e,t,o,r={}){let i="function"==typeof e&&e.prototype||e;Object.hasOwnProperty.call(i,"hcEvents")||(i.hcEvents={});let l=i.hcEvents;n().Point&&e instanceof n().Point&&e.series&&e.series.chart&&(e.series.chart.runTrackerClick=!0);let a=e.addEventListener;a&&a.call(e,t,o,!!n().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==t.indexOf("touch"):r.passive,capture:!1}),l[t]||(l[t]=[]);let c={fn:o,order:"number"==typeof r.order?r.order:1/0};return l[t].push(c),l[t].sort((e,t)=>e.order-t.order),function(){!function(e,t,o){function r(t,o){let r=e.removeEventListener;r&&r.call(e,t,o,!1)}function n(o){let n,i;e.nodeName&&(t?(n={})[t]=!0:n=o,f(n,function(e,t){if(o[t])for(i=o[t].length;i--;)r(t,o[t][i].fn)}))}let i="function"==typeof e&&e.prototype||e;if(Object.hasOwnProperty.call(i,"hcEvents")){let e=i.hcEvents;if(t){let i=e[t]||[];o?(e[t]=i.filter(function(e){return o!==e.fn}),r(t,o)):(n(e),e[t]=[])}else n(e),delete i.hcEvents}}(e,t,o)}}function a(e){return u(e)&&"number"==typeof e.nodeType}function c(e){return"number"==typeof e&&!isNaN(e)&&e<1/0&&e>-1/0}function u(e,t){let o;return!!e&&"object"==typeof e&&(!t||"[object Array]"!==(o=Object.prototype.toString.call(e))&&"[object Array Iterator]"!==o)}function f(e,t,o){for(let r in e)Object.hasOwnProperty.call(e,r)&&t.call(o||e[r],e[r],r,e)}function h(){let e=arguments,t=e.length;for(let o=0;o<t;o++){let t=e[o];if(null!=t)return t}}Array.prototype.find;let p={backgroundColor:"color",backgroundColors:"color",borderColor:"color",borderRadius:"string",color:"color",fill:"color",fontSize:"string",labels:"string",name:"string",stroke:"color",title:"string"},{getAssignedAxis:d}={annotationsFieldsTypes:p,getAssignedAxis:function(e){return e.filter(e=>{let t=e.axis.getExtremes(),o=t.min,r=t.max,n=h(e.axis.minPointOffset,0);return c(o)&&c(r)&&e.value>=o-n&&e.value<=r+n&&!e.axis.options.isInternal})[0]},getFieldType:function(e,t){let o=p[e],r=typeof t;return null!=o&&(r=o),({string:"text",number:"number",boolean:"checkbox",color:"color"})[r]}},y=[],m={enabled:!0,sensitivity:1.1,showResetButton:!1},g=function(t,o,r,n,i,l,s){let a=h(s.type,t.zooming.type,""),c=[];"x"===a?c=r:"y"===a?c=n:"xy"===a&&(c=t.axes);let u=t.transform({axes:c,to:{x:i-5,y:l-5,width:10,height:10},from:{x:i-5*o,y:l-5*o,width:10*o,height:10*o},trigger:"mousewheel",allowResetButton:s.showResetButton});if(u){var f;null!=e&&null!=(f=e)&&clearTimeout(f),e=setTimeout(()=>{t.pointer?.drop()},400)}return u};function b(){var e;let t=(u(e=this.zooming.mouseWheel)||(e={enabled:e??!0}),function(e,...t){let o,r=[e,...t],n={},i=function(e,t){return"object"!=typeof e&&(e={}),f(t,function(o,r){if("__proto__"!==r&&"constructor"!==r){let n;!u(o,!0)||(n=o?.constructor,u(o,!0)&&!a(o)&&n?.name&&"Object"!==n.name)||a(o)?e[r]=t[r]:e[r]=i(e[r]||{},o)}}),e};!0===e&&(n=r[1],r=Array.prototype.slice.call(r,2));let l=r.length;for(o=0;o<l;o++)n=i(n,r[o]);return n}(m,e));t.enabled&&s(this.container,"wheel",e=>{e=this.pointer?.normalize(e)||e;let{pointer:o}=this,r=o&&!o.inClass(e.target,"highcharts-no-mousewheel");if(this.isInsidePlot(e.chartX-this.plotLeft,e.chartY-this.plotTop)&&r){let r=t.sensitivity||1.1,n=e.detail||(e.deltaY||0)/120,i=d(o.getCoordinates(e).xAxis),l=d(o.getCoordinates(e).yAxis);g(this,Math.pow(r,n),i?[i.axis]:this.xAxis,l?[l.axis]:this.yAxis,e.chartX,e.chartY,t)&&e.preventDefault?.()}})}let v=n();v.MouseWheelZoom=v.MouseWheelZoom||{compose:function(e){-1===y.indexOf(e)&&(y.push(e),s(e,"afterGetContainer",b))}},v.MouseWheelZoom.compose(v.Chart);let x=n();export{x as default};